Python Lab Problems

By Ankit Sir
Date: 24 September


πŸ”Ή Input & Variables (Basic)

1. Write a program that takes the user’s name and age as input and prints them.

2. Write a program to take two integers from the user and print their sum.

3. Write a program to take two numbers from the user and print their product.

4. Write a program to take three numbers and print the smallest number.

5. Write a program that takes radius as input and prints the area and circumference of a circle.


πŸ”Ή Sum & Min (Intermediate)

1. Write a program that takes five numbers and prints their total sum.

2. Write a program to take five numbers and print the smallest number.

3. Write a program that asks the user for marks in 3 subjects and prints the average.

4. Write a program to swap two numbers using a third variable.

5. Write a program to swap two numbers without using a third variable.


πŸ”Ή Multiplication & Arithmetic

1. Write a program to print the multiplication table of a number.

2. Write a program to take three numbers and print their sum, product, and average.

3. Write a program to check whether a number is divisible by 5 and 7.

4. Write a program to perform addition, subtraction, multiplication, division, and modulus.

5. Write a program to calculate compound interest using:
A = P * (1 + R/100) ** T


πŸ”Ή Type, Type Casting & Modules

1. Take input from the user and print its type using type().

2. Convert string input ("25") into integer and print value & type.

3. Convert a float value ("12.5") into integer.

4. Import math module and calculate square root.

5. Import random module and generate a number between 1 and 100.


πŸ”Ή Python List Methods (20 Questions)

1. Sort L1 = [5, 2, 9, 1]

2. Reverse L1 = [10, 20, 30, 40]

3. Add 15 at the end of L1 = [5, 10]

4. Insert 25 at index 1 in L1 = [10, 20, 30]

5. Remove element at index 2 from L1 = [4, 8, 12, 16]

6. Remove value 8 from L1 = [2, 4, 8, 10]

7. Sort and reverse L1 = [3, 1, 4, 2]

8. Append 100 to an empty list

9. Insert 10 at beginning of L1 = [1, 2, 3]

10. Output of L1.pop() on L1 = [2, 4, 6, 8]

11. Remove last element from L1 = [1, 2, 3, 4]

12. Insert 99 at index 2 in L1 = [10, 20, 30, 40]

13. Remove first occurrence of 5 from [5, 10, 5, 20]

14. Sort [45, 12, 78, 23] in descending order

15. Reverse L1 = [10, 20, 30, 40]

16. What is output of L1.pop(1) if L1 = [7, 14, 21, 28]

17. Add 10, 20, 30 to an empty list using append()

18. Sort [8, 3, 6, 1] and remove 3

19. Insert 50 at last position using insert()

20. Remove 33 from [11, 22, 33, 44, 55]


πŸ“… Date: 25 November

πŸ”Ή Python range() Questions

1. Print numbers from 1 to 10

2. Print even numbers from 2 to 20

3. Print numbers from 10 to 1

4. Print numbers from 5 to 50 with step 5

5. Print every 3rd number from 1 to 30

6. Print first 10 natural numbers

7. Find sum of numbers from 1 to 100

8. Print table of 7

9. Print: 10, 30, 50, 70, 90

10. Print odd numbers from 1 to 25


πŸ”Ή Moderate range() Questions

1. Print numbers from 50 to 10 divisible by 3

2. Print even numbers from 2 to 16 in two lines

3. Print numbers not divisible by 2 and 5 (1–100)

4. Print squares from 1 to 10

5. Print: 100, 95, 90 … 50

6. Print every second character of a string

7. Print prime numbers between 10 and 50

8. Print star pattern using nested loops

9. Reverse a list using range()

10. Print tables of 5, 6, and 7


πŸ“˜ Important Python Notes:
πŸ‘‰ Click Here to View Notes

Prepared By Ankit Sir | Python Lab