50 Basic Python Practice Programs
(For School Students)
Prepared by Saksham Computers, Jalna
1. Print Hello World
print("Hello World")
2. Print your name
print("My name is Saksham")
3. Add two numbers
a = 10
b = 5
print(a + b)
4. Subtract two numbers
a = 25
b = 8
print(a - b)
5. Multiply two numbers
a = 6
b = 7
print(a * b)
6. Divide two numbers
a = 20
b = 4
print(a / b)
7. Take input from user
name = input("Enter your name: ")
print("Welcome", name)
8. Find area of rectangle
l = int(input("Length: "))
w = int(input("Width: "))
print(l * w)
9. Find area of circle
r = float(input("Radius: "))
pi = 3.14
print(pi * r * r)
10. Simple interest
p = int(input("Principal: "))
r = int(input("Rate: "))
t = int(input("Time: "))
print((p * r * t) / 100)
11. Check if number is even or odd
n = int(input("Enter number: "))
if n % 2 == 0:
print("Even")
else:
print("Odd")
12. Maximum of two numbers
a = 10
b = 20
print(max(a, b))
13. Check age for voting
age = int(input("Enter age: "))
if age >= 18:
print("Eligible")
else:
print("Not Eligible")
14. Print numbers 1 to 10
for i in range(1, 11):
print(i)
15. Print table of any number
n = int(input("Enter number: "))
for i in range(1, 11):
print(n * i)
16. Sum of first 10 numbers
s = 0
for i in range(1, 11):
s += i
print(s)
17. Factorial of a number
n = int(input("Enter number: "))
fact = 1
for i in range(1, n+1):
fact *= i
print(fact)
18. Reverse a string
s = input("Enter text: ")
print(s[::-1])
19. Count vowels in a string
s = input("Enter string: ")
v = 0
for ch in s:
if ch in "aeiouAEIOU":
v += 1
print(v)
20. Check palindrome string
s = input("Enter string: ")
if s == s[::-1]:
print("Palindrome")
else:
print("Not Palindrome")
21. Print list elements
fruits = ["apple", "banana", "mango"]
for f in fruits:
print(f)
22. Add element to list
nums = [1, 2, 3]
nums.append(4)
print(nums)
23. Find largest element in list
nums = [3, 9, 2, 7]
print(max(nums))
24. Sum of list elements
nums = [5, 10, 15]
print(sum(nums))
25. Swap two numbers
a = 5
b = 10
a, b = b, a
print(a, b)
26. Check positive or negative
n = int(input("Enter number: "))
if n > 0:
print("Positive")
else:
print("Negative")
27. Print characters of string
s = "Saksham"
for c in s:
print(c)
28. Square of a number
n = int(input("Number: "))
print(n * n)
29. Cube of a number
n = int(input("Number: "))
print(n * n * n)
30. Simple calculator
a = int(input("A: "))
b = int(input("B: "))
print("1 Add 2 Sub 3 Mul 4 Div")
c = int(input("Choice: "))
if c == 1:
print(a + b)
elif c == 2:
print(a - b)
elif c == 3:
print(a * b)
elif c == 4:
print(a / b)
31. Print even numbers 1 to 20
for i in range(1, 21):
if i % 2 == 0:
print(i)
32. Print odd numbers 1 to 20
for i in range(1, 21):
if i % 2 != 0:
print(i)
33. Print sum of digits
n = int(input("Number: "))
s = 0
while n > 0:
s += n % 10
n //= 10
print(s)
34. Reverse a number
n = int(input("Number: "))
rev = 0
while n > 0:
rev = rev * 10 + n % 10
n //= 10
print(rev)
35. Fibonacci series
a, b = 0, 1
for i in range(10):
print(a)
a, b = b, a + b
36. Print star pattern
for i in range(1, 6):
print("*" * i)
37. Find smallest number
nums = [4, 9, 1, 7]
print(min(nums))
38. Convert Celsius to Fahrenheit
c = float(input("Celsius: "))
f = c * 9/5 + 32
print(f)
39. Convert Fahrenheit to Celsius
f = float(input("Fahrenheit: "))
c = (f - 32) * 5/9
print(c)
40. Check number is divisible by 5
n = int(input("Enter number: "))
if n % 5 == 0:
print("Divisible")
else:
print("Not Divisible")
41. Find average of 5 numbers
a, b, c, d, e = 5, 10, 15, 20, 25
print((a + b + c + d + e) / 5)
42. Count words in a sentence
s = input("Enter sentence: ")
print(len(s.split()))
43. Check leap year
y = int(input("Year: "))
if (y % 400 == 0) or (y % 4 == 0 and y % 100 != 0):
print("Leap Year")
else:
print("Not Leap")
44. Create a function
def greet():
print("Hello from Saksham")
greet()
45. Function to add 2 numbers
def add(a, b):
return a + b
print(add(5, 8))
46. Store student names in list
students = ["Amit", "Sneha", "Riya"]
print(students)
47. Simple dictionary example
student = {"name": "Saksham", "age": 14, "class": 8}
print(student)
48. Print squares of 1 to 10
for i in range(1, 11):
print(i * i)
49. Find length of string
s = input("Enter text: ")
print(len(s))
50. Program to greet user
name = input("Enter your name: ")
print("Hello", name, "Welcome to Saksham Computers")
If you want, I can:
• Put a heading and introduction so it looks like a neat blog post
• Convert this into a PDF or poster
• Add practice questions and assignments for students
Just tell me what you want.
You said:
ChatGPT said:
Here is a clean and ready blog post. You can copy and paste it directly on your website. I have kept the language simple for students and added your institute name at the end.
Basic Python Practice Programs for School Students
A Take Home Exercise Set of 50 Programs
Prepared by Saksham Computers Jalna
Python is one of the easiest programming languages for students in classes 6 to 10. These simple practice programs will help students understand the basics of input, output, variables, conditions, loops, lists and small logic building. Students can practice these at home and improve their programming skills.
Below are 50 beginner friendly programs.
1. Print Hello World
print("Hello World")
2. Print your name
print("My name is Saksham")
3. Add two numbers
a = 10 b = 5 print(a + b)
4. Subtract two numbers
a = 25 b = 8 print(a - b)
5. Multiply two numbers
a = 6 b = 7 print(a * b)
6. Divide two numbers
a = 20 b = 4 print(a / b)
7. Take input from user
name = input("Enter your name: ")
print("Welcome", name)
8. Area of rectangle
l = int(input("Length: "))
w = int(input("Width: "))
print(l * w)
9. Area of circle
r = float(input("Radius: "))
pi = 3.14
print(pi * r * r)
10. Simple interest
p = int(input("Principal: "))
r = int(input("Rate: "))
t = int(input("Time: "))
print((p * r * t) / 100)
11. Check if number is even or odd
n = int(input("Enter number: "))
if n % 2 == 0:
print("Even")
else:
print("Odd")
12. Maximum of two numbers
a = 10
b = 20
print(max(a, b))
13. Age eligibility for voting
age = int(input("Enter age: "))
if age >= 18:
print("Eligible")
else:
print("Not Eligible")
14. Print numbers 1 to 10
for i in range(1, 11):
print(i)
15. Print table of a number
n = int(input("Enter number: "))
for i in range(1, 11):
print(n * i)
16. Sum of first 10 numbers
s = 0
for i in range(1, 11):
s += i
print(s)
17. Factorial of a number
n = int(input("Enter number: "))
fact = 1
for i in range(1, n+1):
fact *= i
print(fact)
18. Reverse a string
s = input("Enter text: ")
print(s[::-1])
19. Count vowels in a string
s = input("Enter string: ")
v = 0
for ch in s:
if ch in "aeiouAEIOU":
v += 1
print(v)
20. Check palindrome
s = input("Enter string: ")
if s == s[::-1]:
print("Palindrome")
else:
print("Not Palindrome")
21. Print list elements
fruits = ["apple", "banana", "mango"]
for f in fruits:
print(f)
22. Add element to list
nums = [1, 2, 3]
nums.append(4)
print(nums)
23. Largest element in list
nums = [3, 9, 2, 7]
print(max(nums))
24. Sum of list elements
nums = [5, 10, 15]
print(sum(nums))
25. Swap two numbers
a = 5 b = 10 a, b = b, a print(a, b)
26. Check positive or negative
n = int(input("Enter number: "))
if n > 0:
print("Positive")
else:
print("Negative")
27. Print characters of string
s = "Saksham"
for c in s:
print(c)
28. Square of a number
n = int(input("Number: "))
print(n * n)
29. Cube of a number
n = int(input("Number: "))
print(n * n * n)
30. Simple calculator
a = int(input("A: "))
b = int(input("B: "))
print("1 Add 2 Sub 3 Mul 4 Div")
c = int(input("Choice: "))
if c == 1:
print(a + b)
elif c == 2:
print(a - b)
elif c == 3:
print(a * b)
elif c == 4:
print(a / b)
31. Print even numbers 1 to 20
for i in range(1, 21):
if i % 2 == 0:
print(i)
32. Print odd numbers 1 to 20
for i in range(1, 21):
if i % 2 != 0:
print(i)
33. Sum of digits
n = int(input("Number: "))
s = 0
while n > 0:
s += n % 10
n //= 10
print(s)
34. Reverse a number
n = int(input("Number: "))
rev = 0
while n > 0:
rev = rev * 10 + n % 10
n //= 10
print(rev)
35. Fibonacci series
a, b = 0, 1
for i in range(10):
print(a)
a, b = b, a + b
36. Star pattern
for i in range(1, 6):
print("*" * i)
37. Smallest number in list
nums = [4, 9, 1, 7]
print(min(nums))
38. Celsius to Fahrenheit
c = float(input("Celsius: "))
f = c * 9/5 + 32
print(f)
39. Fahrenheit to Celsius
f = float(input("Fahrenheit: "))
c = (f - 32) * 5/9
print(c)
40. Divisible by 5
n = int(input("Enter number: "))
if n % 5 == 0:
print("Divisible")
else:
print("Not Divisible")
41. Average of five numbers
a, b, c, d, e = 5, 10, 15, 20, 25
print((a + b + c + d + e) / 5)
42. Count words in sentence
s = input("Enter sentence: ")
print(len(s.split()))
43. Check leap year
y = int(input("Year: "))
if (y % 400 == 0) or (y % 4 == 0 and y % 100 != 0):
print("Leap Year")
else:
print("Not Leap")
44. Create simple function
def greet():
print("Hello from Saksham")
greet()
45. Function to add numbers
def add(a, b):
return a + b
print(add(5, 8))
46. Store student names in list
students = ["Amit", "Sneha", "Riya"]
print(students)
47. Dictionary example
student = {"name": "Saksham", "age": 14, "class": 8}
print(student)
48. Squares of numbers 1 to 10
for i in range(1, 11):
print(i * i)
49. Length of a string
s = input("Enter text: ")
print(len(s))
50. Greet the user
name = input("Enter your name: ")
print("Hello", name, "Welcome to Saksham Computers")