Skip to content
Projects

DairHX/Python_Basics_Exercises

View on GitHub

DairHX/Python_Basics_Exercises has 27 GitHub stars and 4 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-15 08:10 UTC. Last push 2025-07-21.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

🐍 A series of beginner to advanced Python basics exercises with solutions to help you learn and practice the fundamentals of Python programming.

Learning

README.md

Original

🧠 Python Practice Exercises

A progressive set of hands‑on challenges—simple → intermediate → advanced—to sharpen your Python fundamentals before Python_For Pentesters_Basics and beyond.


✅ Simple Exercises

# Exercise Goal / Instructions
1 Calculate the Factorial of a Number Ask the user for a positive integer → use a loop to compute n! → return & print the result.
2 Sum of Digits of a Number Ask for an integer → treat it as a string → loop & sum the digits → print the total.
3 Find the Minimum and Maximum in a List Ask for a list → use min() / max() → display both values.
4 Average of Several Numbers Ask for numbers → compute sum / len → print the average.
5 Generate a Multiplication Table Ask for a base number & limit → loop and print n × i for each i.
6 Solve a First‑Degree Equation (ax + b = 0) Ask for a, b → if a ≠ 0, solve x = −b/a; else decide no / infinite solutions.
7 Sum of Squares in a List Ask for a list → square each → sum & print.
8 Average of Even Numbers in a List Ask for a list → filter evens → average them or report none.
9 Check if a List is Increasing Verify each element is ≤ the next → print whether ascending.

⚙️ Intermediate Exercises

# Exercise Goal / Instructions
10 Find Prime Numbers in a List Write is_prime() → apply to the list → display primes.
11 Find Multiples in a Range Given n, a, b → loop a…b → collect numbers divisible by n.
12 Calculate the GCD (Euclid’s Algorithm) Ask for two integers → use Euclid’s method → print the GCD.
13 Generate Fibonacci Sequence Ask for n → loop to build the sequence → print it.
14 Find Perfect Numbers in a List Sum proper divisors → keep numbers equal to that sum → display them.
15 Celsius ↔ Fahrenheit Converter Ask conversion direction → apply C → F or F → C formula → print result.

🔬 Advanced Exercises

# Exercise Goal / Instructions
16 Implement Selection Sort Repeatedly find the smallest element & move it front using list.remove() → print sorted list.
17 Check if a String is a Palindrome Ignore spaces / punctuation / case → state if it’s a palindrome.
18 Solve a Quadratic Equation Ask for a, b, c → compute Δ = b² − 4ac → output real or complex roots.

How to Run

# clone the repo
git clone https://github.com/your-username/python_practice.git
cd python_practice

# run any exercise
python simple_exercises/ex01_factorial.py