Full source code + step-by-step explanation for 5 Python projects. Build your portfolio, practice logic, and get placement-ready.
Enter your email and we'll send you the full source code + guide instantly.
No spam. Unsubscribe anytime. Your email is safe with us.
A command-line calculator that handles basic arithmetic, memory functions, and error handling. Great for understanding functions and user input.
def calculator():
print("=== Python Calculator ===")
while True:
op = input("Enter op (+, -, *, /, q to quit): ")
if op == 'q': break
a, b = float(input("a: ")), float(input("b: "))
ops = {'+': a+b, '-': a-b, '*': a*b, '/': a/b if b else 'Error'}
print(f"Result: {ops.get(op, 'Invalid op')}\n")
A multiple-choice quiz with score tracking and timer. Teaches dictionaries, lists, and conditional logic.
quiz = {
"What is the output of 2**3?": ["6", "8", "9", "4"],
"Which is mutable?": ["tuple", "list", "str", "int"]
}
score = 0
for q, opts in quiz.items():
print(q)
for i, o in enumerate(opts, 1): print(f"{i}. {o}")
ans = int(input("Your answer (1-4): "))
if ans == 2: score += 1 # correct answers at index 1
print(f"Score: {score}/{len(quiz)}")
A task manager with add, delete, complete, and save-to-file features. Teaches file I/O and CRUD operations.
tasks = []
def add(t): tasks.append({"task": t, "done": False})
def show():
for i, t in enumerate(tasks, 1):
status = "✅" if t["done"] else "⬜"
print(f"{i}. {status} {t['task']}")
def done(i): tasks[i-1]["done"] = True
def save():
with open("tasks.txt", "w") as f:
for t in tasks: f.write(f"{t['task']}|{t['done']}\n")
Generates strong random passwords with configurable length and character types. Teaches random module and string manipulation.
import random, string
def generate(length=12, use_special=True):
chars = string.ascii_letters + string.digits
if use_special: chars += "!@#$%^&*"
pwd = ''.join(random.choice(chars) for _ in range(length))
# Ensure at least one of each type
if not any(c.isdigit() for c in pwd): pwd += random.choice(string.digits)
return pwd
print(generate(16)) # e.g. "aK8#mP2$xL9@qR5!"
Fetches live weather data from OpenWeatherMap API. Teaches API calls, JSON parsing, and error handling.
import requests, json
def get_weather(city):
key = "YOUR_API_KEY" # Get free key at openweathermap.org
url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={key}&units=metric"
try:
data = requests.get(url).json()
temp = data["main"]["temp"]
desc = data["weather"][0]["description"]
print(f"{city}: {temp}°C, {desc}")
except: print("City not found or API error")
get_weather("Kochi")