Python Beginner Projects – Learn by Building
Python Beginner Projects – Learn by Building
The best way to learn Python is by making small projects.Here are 5 easy beginner projects with simple code.
1. Simple Calculator
2. Number Guessing Game
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Addition:", a + b)
print("Subtraction:", a - b)
print("Multiplication:", a * b)
print("Division:", a / b)import random
number = random.randint(1, 10)
guess = int(input("Guess a number: "))
if guess == number:
print("You won!")
else:
print("You lost! Number was", number)
3. To-Do List Program
tasks = []
while True:
task = input("Enter a task (or type exit): ")
if task == "exit":
break
tasks.append(task)
print("Your tasks:")
for t in tasks:
print("-", t)
4. Password Generator
import random
import string
chars = string.ascii_letters + string.digits
password = "".join(random.choice(chars) for i in range(8))
print("Your password:", password)
5. Quiz Game
score = 0
q1 = input("What is 2+2? ")
if q1 == "4":
score += 1
q2 = input("Capital of India? ")
if q2.lower() == "delhi":
score += 1
print("Your score:", score)
These projects help you practice and gain confidence
Comments
Post a Comment