O Level Python Practical File
Program 1: Print Hello World
print("Hello World")
Program 2: Input and Output
name = input("Enter name: ") print(name)
Program 3: If Else Example
age = 18 if age>=18: print("Eligible") else: print("Not Eligible")
Program 4: For Loop
for i in range(1,6): print(i)
Program 5: While Loop
i=1 while i<=5: print(i) i+=1
Program 6: List Example
lst=[1,2,3] print(lst)
Program 7: Tuple Example
tup=(1,2,3) print(tup)
Program 8: Dictionary Example
d={"name":"Ram","class":10} print(d)
Program 9: Function Example
def add(a,b): return a+b print(add(2,3))
Program 10: Simple Calculator
a=10 b=5 print(a+b,a-b,a*b,a/b)