✅ PROJECT 1: Basic Calculator
def add(a, b): return a + b
def sub(a, b): return a - b
def mul(a, b): return a * b
def div(a, b): return a / b
print("1.Add 2.Subtract 3.Multiply 4.Divide")
choice = int(input("Choose: "))
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
if choice == 1: print("Answer:", add(a, b))
elif choice == 2: print("Answer:", sub(a, b))
elif choice == 3: print("Answer:", mul(a, b))
elif choice == 4: print("Answer:", div(a, b))
else: print("Invalid Choice")
✅ PROJECT 2: Number Guessing Game
import random
number = random.randint(1, 10)
while True:
guess = int(input("Guess the number (1–10): "))
if guess == number:
print("Correct! You win.")
break
else:
print("Wrong! Try again.")
✅ PROJECT 3: To-Do List
tasks = []
while True:
print("\n1.Add 2.View 3.Delete 4.Exit")
choice = int(input("Choose: "))
if choice == 1:
tasks.append(input("Enter task: "))
elif choice == 2:
for i, t in enumerate(tasks):
print(i, t)
elif choice == 3:
idx = int(input("Enter index to delete: "))
tasks.pop(idx)
elif choice == 4:
break
✅ PROJECT 4: Student Marks Program
name = input("Enter name: ")
m1 = int(input("Maths: "))
m2 = int(input("Science: "))
m3 = int(input("English: "))
total = m1 + m2 + m3
avg = total / 3
print("Total:", total)
print("Average:", avg)
✅ PROJECT 5: Rock–Paper–Scissors
import random
choices = ["rock", "paper", "scissors"]
user = input("Enter rock/paper/scissors: ").lower()
computer = random.choice(choices)
print("Computer:", computer)
if user == computer:
print("Draw!")
elif (user == "rock" and computer == "scissors") or \
(user == "paper" and computer == "rock") or \
(user == "scissors" and computer == "paper"):
print("You win!")
else:
print("You lose!")
✅ PROJECT 6: Weather Temperature Plot (matplotlib)
import matplotlib.pyplot as plt
days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
temp = [30, 32, 31, 29, 35, 36, 34]
plt.plot(days, temp, marker='o')
plt.xlabel("Days")
plt.ylabel("Temperature")
plt.title("Weekly Temperature")
plt.show()
✅ PROJECT 7: Contact Book
contacts = {}
while True:
print("\n1.Add 2.Search 3.View All 4.Exit")
c = int(input("Choose: "))
if c == 1:
name = input("Name: ")
phone = input("Phone: ")
contacts[name] = phone
elif c == 2:
n = input("Search name: ")
print("Phone:", contacts.get(n, "Not found"))
elif c == 3:
print(contacts)
else:
break
✅ PROJECT 8: Quiz Game
questions = {
"Capital of India?": "Delhi",
"5 + 7 = ?": "12",
"National animal of India?": "Tiger"
}
score = 0
for q, ans in questions.items():
if input(q + " ") == ans:
score += 1
print("Score:", score)
✅ PROJECT 9: Digital Clock (Tkinter)
import tkinter as tk
import time
root = tk.Tk()
root.title("Digital Clock")
label = tk.Label(root, font=("Arial", 40), fg="blue")
label.pack()
def update():
label.config(text=time.strftime("%H:%M:%S"))
label.after(1000, update)
update()
root.mainloop()
✅ PROJECT 10: Password Generator
import random
import string
length = int(input("Password length: "))
chars = string.ascii_letters + string.digits + string.punctuation
password = "".join(random.choice(chars) for _ in range(length))
print("Password:", password)
✅ PROJECT 11: Student Result Dashboard (pandas + matplotlib)
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({
"Name": ["A", "B", "C", "D"],
"Marks": [78, 85, 90, 70]
})
print(df)
plt.bar(df["Name"], df["Marks"])
plt.title("Student Marks")
plt.show()
✅ PROJECT 12: Sales Excel Analysis
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_excel("sales.xlsx")
plt.plot(df["Month"], df["Sales"], marker='o')
plt.title("Monthly Sales Trend")
plt.show()
✅ PROJECT 13: Expense Tracker
expenses = []
while True:
print("\n1.Add Expense 2.View Expenses 3.Total 4.Exit")
c = int(input("Choose: "))
if c == 1:
amt = float(input("Amount: "))
desc = input("Description: ")
expenses.append((amt, desc))
elif c == 2:
print(expenses)
elif c == 3:
print("Total:", sum(x[0] for x in expenses))
else:
break
✅ PROJECT 14: Simple Chatbot
while True:
user = input("You: ")
if "hi" in user.lower():
print("Bot: Hello!")
elif "name" in user.lower():
print("Bot: I am ChatBot.")
elif "bye" in user.lower():
print("Bot: Goodbye!")
break
else:
print("Bot: I don't understand.")
✅ PROJECT 15: Sine Wave Plot
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y)
plt.title("Sine Wave")
plt.xlabel("x")
plt.ylabel("sin(x)")
plt.grid(True)
plt.show()
No comments:
Post a Comment