A collection of beginner-friendly Python exercises covering core control flow concepts: loops, conditionals, functions, and recursion.
A simple login flow with username/password validation and an interactive menu.
- Concepts:
whileloop,if/elif/else,continue,break,sys.exit() - File:
login.py - Sample output:
output.txt
Three different ways to check if a value is a palindrome.
- Concepts:
whileloops, string slicing, functions, recursion - File:
palindrome.py
Requires Python 3.x.
# Login system
cd login_system
python3 login.py
# Palindrome checker
cd palindrome
python3 palindrome.py| Topic | Where |
|---|---|
while True loops |
login.py, palindrome.py |
if/elif/else |
both |
continue / break |
login.py |
sys.exit() |
login.py |
String slicing s[::-1] |
palindrome.py |
| Recursion | palindrome.py |
- The login credentials in
login.pyare demo only — never hardcode real passwords in plain code. - All scripts use only the Python standard library.
MIT — feel free to use, learn from, and modify.