Python Mini Projects
These projects combine everything you’ve learned so far — variables, functions, conditionals, loops, strings, and more.
🔹 Project 1: Simple Calculator
💡 What It Does:
Performs basic operations: addition, subtraction, multiplication, and division.
Python
def calculator(a, b, op):
if op == "+":
return a + b
elif op == "-":
return a - b
elif op == "*":
return a * b
elif op == "/":
return a / b
else:
return "Invalid operator"
x = float(input("Enter first number: "))
y = float(input("Enter second number: "))
operator = input("Enter operator (+, -, *, /): ")
print("Result:", calculator(x, y, operator))
✅ Try:
Enter first number: 10
Enter second number: 5
Enter operator: *
Result: 50.0
✅ Output

🔹 Project 2: Number Guessing Game
💡 What It Does:
Computer chooses a random number. You try to guess it.
Python
import random
secret = random.randint(1, 10)
guess = 0
while guess != secret:
guess = int(input("Guess a number (1-10): "))
if guess < secret:
print("Too low!")
elif guess > secret:
print("Too high!")
else:
print("You got it!")
✅ Example:
Guess a number (1-10): 1
Too low!
Guess a number (1-10): 2
Too low!
Guess a number (1-10): 3
Too low!
Guess a number (1-10): 4
Too low!
Guess a number (1-10): 9
You got it!
✅ Output

🔹 Project 3: Student Grade System
💡 What It Does:
Takes marks and returns a grade.
Python
def get_grade(score):
if score >= 90:
return "A"
elif score >= 75:
return "B"
elif score >= 60:
return "C"
else:
return "D"
name = input("Enter student name: ")
score = int(input("Enter score: "))
print(name + " got grade:", get_grade(score))
✅ Example:
Enter student name: Riya
Enter score: 81
Riya got grade: B
✅ Output

🔹 Project 4: Basic Quiz App
💡 What It Does:
Asks multiple choice questions and shows final score.
Python
questions = {
"What is the capital of India?": "Delhi",
"What is 2 + 2?": "4",
"Python is which type of language?": "Programming"
}
score = 0
for q, a in questions.items():
ans = input(q + " ")
if ans.strip().lower() == a.lower():
score += 1
print("You scored", score, "out of", len(questions))
✅ Example:
What is the capital of India? delhi
What is 2 + 2? 4
Python is which type of language? programming
You scored 3 out of 3
✅ output

🎯 Summary
You now have real working projects that:
- Take input from users
- Use conditions, loops, and functions
- Display dynamic output
These can be expanded later into full apps!