Here are more beginner-friendly examples for Lesson 1: Introduction to Python, with clear explanations and practical use cases. These are perfect if youβre just starting or teaching Python basics.
1οΈβ£ Python as a Calculator
print(10 + 5)
print(20 - 7)
print(4 * 6)
print(20 / 4)
print(10 % 3) # Remainder
print(2 ** 3) # Power
Output
15
13
24
5.0
1
8
2οΈβ£ Printing Multiple Values
name = "Ali"
age = 25
city = "Delhi"
print(name, age, city)
Output
Ali 25 Delhi
3οΈβ£ Using type() to Check Data Type
x = 10
y = 3.5
z = "Python"
is_active = True
print(type(x))
print(type(y))
print(type(z))
print(type(is_active))
4οΈβ£ Simple Variable Usage
price = 100
quantity = 3
total = price * quantity
print("Total price:", total)
5οΈβ£ String Examples
message = "Welcome to Python"
print(message.upper())
print(message.lower())
print(message[0])
print(message[-1])
6οΈβ£ Taking User Input
name = input("Enter your name: ")
print("Hello", name)
7οΈβ£ Converting Input Data Type
age = int(input("Enter your age: "))
print("Next year you will be", age + 1)
8οΈβ£ Simple Program: Student Info
name = input("Enter student name: ")
marks = int(input("Enter marks: "))
print("Student:", name)
print("Marks:", marks)
9οΈβ£ Comments in Python
# This is a single-line comment
"""
This is a
multi-line
comment
"""
print("Comments example")
π Python Is Case-Sensitive
name = "Python"
Name = "Programming"
print(name)
print(Name)

Leave a Reply