Projects = Fast Learning. Niche projects ke through aap input/output, loops, lists, dictionaries, functions, modules jaise concepts ko practically samjhenge. Niche diye gaye 10 projects copy-paste runnable code ke saath hain.
Concepts: Input/Output, Operators, Basic Validation
# calculator.py
def calc(a, b):
return {
"sum": a + b,
"diff": a - b,
"prod": a * b,
"quot": a / b if b != 0 else "∞ (division by zero)"
}
try:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
result = calc(a, b)
for k, v in result.items():
print(f"{k} = {v}")
except ValueError:
print("Please enter valid numbers!")
Concepts: Lists, Loops, File I/O (persistence)
# todo.py
import json, os
DB = "tasks.json"
def load_tasks():
return json.load(open(DB)) if os.path.exists(DB) else []
def save_tasks(tasks):
json.dump(tasks, open(DB, "w"), indent=2)
def show(tasks):
if not tasks: print("No tasks."); return
for i, t in enumerate(tasks, 1): print(f"{i}. {t}")
tasks = load_tasks()
while True:
cmd = input("(A)dd (D)elete (L)ist (Q)uit: ").lower().strip()
if cmd == "a":
tasks.append(input("Task: ").strip())
save_tasks(tasks); print("Added.")
elif cmd == "d":
show(tasks)
try:
i = int(input("Delete #?: "))
tasks.pop(i-1); save_tasks(tasks); print("Deleted.")
except: print("Invalid.")
elif cmd == "l": show(tasks)
elif cmd == "q": break
else: print("Unknown command.")
Concepts: Random, Loops, Conditions
# guess.py
import random
secret = random.randint(1, 10)
for attempt in range(3):
try:
g = int(input("Guess (1-10): "))
if g == secret:
print("Correct! 🎉"); break
print("Too low" if g < secret else "Too high")
except: print("Enter a number!")
else:
print("Out of tries! Number was:", secret)
Concepts: Dict, Loops, Scoring
# quiz.py
q = {
"2 + 2 = ?": "4",
"Capital of India?": "Delhi",
"Language of 'print()' function?": "Python"
}
score = 0
for ques, ans in q.items():
user = input(ques + " ").strip().lower()
if user == ans.lower(): score += 1
print(f"Your Score: {score}/{len(q)}")
Concepts: Random, Game Logic
# rps.py
import random
choices = ["rock", "paper", "scissors"]
user = input("Your choice (rock/paper/scissors): ").lower()
comp = random.choice(choices)
print("Computer:", comp)
win = (user == "rock" and comp == "scissors") or \
(user == "paper" and comp == "rock") or \
(user == "scissors" and comp == "paper")
if user == comp: print("Draw")
elif win: print("You Win!")
elif user in choices: print("You Lose!")
else: print("Invalid choice")
Concepts: Random, Strings, Functions
# password_gen.py
import random, string
def gen_password(length=12, use_symbols=True):
chars = string.ascii_letters + string.digits
if use_symbols: chars += "!@#$%^&*()-_=+[]{}"
return "".join(random.choice(chars) for _ in range(length))
print("Strong Password:", gen_password(14))
Concepts: Math, Input Validation, Formatting
# bmi.py
def bmi(h_m, w_kg):
b = w_kg/(h_m*h_m)
if b < 18.5: cat = "Underweight"
elif b < 25: cat = "Normal"
elif b < 30: cat = "Overweight"
else: cat = "Obese"
return b, cat
try:
h = float(input("Height (meters): "))
w = float(input("Weight (kg): "))
val, cat = bmi(h, w)
print(f"BMI: {val:.2f} → {cat}")
except: print("Please enter valid numbers.")
Concepts: time module, Loops
# stopwatch.py
import time
print("Press Ctrl+C to stop")
start = time.time()
try:
while True:
elapsed = time.time() - start
print(f"\rElapsed: {elapsed:0.1f}s", end="")
time.sleep(0.1)
except KeyboardInterrupt:
print("\nStopped.")
Concepts: OS module, File Handling
# file_organizer.py
import os, shutil, pathlib
RULES = {".jpg":"Images",".png":"Images",".pdf":"Docs",".txt":"Docs",".zip":"Zips",".py":"Code"}
def organize(folder="."):
folder = pathlib.Path(folder)
for f in folder.iterdir():
if f.is_file():
ext = f.suffix.lower()
target = folder / RULES.get(ext, "Others")
target.mkdir(exist_ok=True)
shutil.move(str(f), str(target/f.name))
organize(".") # current directory
print("Organized!")
Concepts: HTTP requests, JSON parsing (mock fallback)
# weather.py (mock without API key)
data = {"city": "Delhi", "temp_c": 33.5, "cond": "Haze"}
print(f"{data['city']}: {data['temp_c']}°C, {data['cond']}")
# If you have 'requests' and an API key:
# import requests
# url = "https://api.open-meteo.com/v1/forecast?latitude=28.61&longitude=77.21¤t_weather=true"
# r = requests.get(url).json()
# cw = r.get("current_weather", {})
# print("Delhi:", cw.get("temperature"), "°C, wind", cw.get("windspeed"))
Yes. Simple syntax, huge community, aur bahut saare ready libraries.
Jo daily life me useful ho (calculators, organizers, notes). Chhota start karo, features add karte jao.
Input validation, files/database save, CLI se GUI/Flask web app tak upgrade.
Agar aapko is post ka ZIP source + printable PDF chahiye, niche comment karein ya contact page se message bhejein. Main next update me download link add kar dunga.