Quick answerGood first Python projects are a quiz game, a dice roller, a tip calculator, a password generator, a to-do list, a unit converter, a word-frequency counter and a simple bank account class. Each uses input(), loops, lists or dictionaries and fits in under 30 lines — the full code for all eight is below and runs online.
1. Quiz game
Run ▸questions = {
"What is 7 x 8? ": "56",
"Which keyword defines a function? ": "def",
"What does len('python') return? ": "6",
}
score = 0
for question, answer in questions.items():
if input(question).strip().lower() == answer:
print("Correct!")
score += 1
else:
print("The answer is", answer)
print(f"You scored {score}/{len(questions)}")
Make it yours: shuffle the questions with random.shuffle, or load them from a list of tuples.
2. Dice roller
Run ▸import random
rolls = int(input("How many dice? "))
results = [random.randint(1, 6) for _ in range(rolls)]
print("You rolled:", results, "total:", sum(results))
3. Tip calculator
Run ▸bill = float(input("Bill amount: "))
tip = int(input("Tip % (10, 15, 20): "))
people = int(input("Split between how many people? "))
total = bill * (1 + tip / 100)
print(f"Each person pays ${total / people:.2f}")
4. Password generator
Run ▸import random, string
length = int(input("Password length: "))
chars = string.ascii_letters + string.digits + "!@#$%&*"
password = "".join(random.choice(chars) for _ in range(length))
print("Your password:", password)
For real passwords use secrets.choice instead of random.choice — it's designed for security.
5. To-do list
Run ▸todos = []
while True:
cmd = input("add / done / list / quit: ").strip().lower()
if cmd == "add":
todos.append(input("Task: "))
elif cmd == "done":
n = int(input("Number of finished task: "))
print("Removed:", todos.pop(n - 1))
elif cmd == "list":
for i, task in enumerate(todos, 1):
print(i, task)
elif cmd == "quit":
break
6. Unit converter
Run ▸RATES = {("km", "mi"): 0.621371, ("mi", "km"): 1.609344, ("kg", "lb"): 2.204623, ("lb", "kg"): 0.453592}
value = float(input("Value: "))
src = input("From (km, mi, kg, lb): ")
dst = input("To: ")
rate = RATES.get((src, dst))
print(f"{value} {src} = {value * rate:.2f} {dst}" if rate else "Can't convert those units")
7. Word frequency counter
Run ▸from collections import Counter
text = input("Paste some text: ").lower()
words = [w.strip(".,!?;:") for w in text.split()]
for word, count in Counter(words).most_common(3):
print(word, count)
8. Bank account (classes)
Run ▸class Account:
def __init__(self, owner):
self.owner = owner
self.history = []
@property
def balance(self):
return sum(self.history)
def deposit(self, amount):
self.history.append(amount)
def withdraw(self, amount):
if amount > self.balance:
print("Declined: insufficient funds")
else:
self.history.append(-amount)
acct = Account("Lee")
acct.deposit(100)
acct.withdraw(30)
acct.withdraw(500)
print(acct.owner, "has", acct.balance)
Where to go next
Add a feature to each project, then try bigger ones: hangman, a text adventure, or a turtle drawing app. Short on ideas? The Python games and exercises are good next steps, and the cheat sheet has all the syntax in one place.
Python Coding - Learn Python for Android: a real Python 3 interpreter, code editor, 26 example programs and 12 marked exercises.
Frequently asked questions
What is a good first Python project?
Something small you'd actually use: a quiz, a tip calculator or a password generator. Each needs only input(), variables and a loop.
Do I need to install anything for these projects?
No — each one runs in the online compiler with one click.
How do I make my project better?
Add validation (try/except around int()), save data to a file, or turn repeated code into functions.