Mini programs · Python Programs

Mini programs combine input, conditions, loops and functions into something that feels like a real tool. Every page includes complete code you can run, sample output and ideas to extend it.

All 7

Python Number Guessing Game Program
A number guessing game picks a secret number with `random.randint()`, then loops with `input()` telling the player "too low" or "…
Python Simple Calculator Program
A simple Python calculator reads two numbers and an operator with `input()`, then uses `if/elif` (or a dictionary of functions) t…
Python Random Password Generator Program
A Python password generator joins randomly chosen characters from `string.ascii_letters`, `string.digits` and `string.punctuation…
Python BMI Calculator Program
A BMI calculator computes `weight_kg / height_m ** 2` and uses `if/elif` to name the category: below 18.5 underweight, below 25 n…
Python Rock Paper Scissors Game Program
A Python rock paper scissors game lets the computer pick with `random.choice()`, reads the player's choice with `input()` and dec…
Python Tip Calculator Program (Split the Bill)
A tip calculator multiplies the bill by the tip percentage divided by 100, adds it to the bill, then divides the total by the num…
Python Star Pattern Programs (Triangle, Pyramid, Diamond)
Star patterns in Python are printed row by row with a loop and string repetition: `print("*" * i)` gives a right triangle, and `p…

Explore more

Python ReferencePython ComparisonsPython How-To GuidesPython Cheat SheetsPython glossaryPython tutorial