1.
Hello World(Printing output, basic syntax)
print("Hello, World!")
2. Simple Calculator(Arithmetic operators)
a = 10
b = 5
print("Addition:", a + b)
print("Subtraction:", a - b)
print("Multiplication:", a * b)
print("Division:", a / b)
3. Input from User(User input, strings)
name = input("Enter your name: ")
print("Hello,", name)
4. Even or Odd(Conditional statements)
num = int(input("Enter a number: "))
if num % 2 == 0:
print(num, "is even.")
else:
print(num, "is odd.")
5. Find the Largest of Three Numbers(if-elif-else, comparison)
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a >= b and a >= c:
print("Largest:", a)
elif b >= a and b >= c:
print("Largest:", b)
else:
print("Largest:", c)
6. Sum of First N Natural Numbers(Loops, range, variables)
n = int(input("Enter a number: "))
total = 0
for i in range(1, n+1):
total += i
print("Sum is:", total)
7. Multiplication Table(Looping, formatting)
num = int(input("Enter a number: "))
for i in range(1, 11):
print(f"{num} x {i} = {num*i}")
8. List Basics(Lists, loops)
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print("I like", fruit)
9. Simple Chatbot (if-else based)
msg = input("You: ")
if "hello" in [Link]():
print("Bot: Hello! How can I help you?")
elif "how are you" in [Link]():
print("Bot: I'm a bot, always good!")
else:
print("Bot: Sorry, I didn’t understand.")
if, in, .lower(), simple logic
10. Basic Function(Functions, parameters)
def greet(name):
print("Hello,", name)
greet("Ananya")