PYTHON PRACTICE QUESTIONS (BASICS)
1. Variables (Easy)
Take two numbers from user and print:
- Sum
- Difference
- Multiplication
- Division
------------------------------------------------------------
2. Variables (Medium)
Take 3 subject marks from user and:
- Calculate total
- Calculate average
- If average >= 50 → print "Pass"
- Else → print "Fail"
------------------------------------------------------------
3. List (Easy)
Create a list of 5 numbers.
- Print first number
- Print last number
- Print length of list
------------------------------------------------------------
4. List (Medium)
Take 5 numbers from user and store in list.
- Print maximum number
- Print minimum number
- Print sum of all numbers
------------------------------------------------------------
5. List (Hard)
Take 6 numbers in list.
Print only EVEN numbers using loop.
Example:
Input: [1,2,3,4,5,6]
Output: 2 4 6
------------------------------------------------------------
6. Tuple (Easy)
Create a tuple of 5 cities.
Check if "Lahore" exists in it.
If yes → print "Found"
Else → print "Not Found"
------------------------------------------------------------
7. Tuple (Medium)
Create a tuple of numbers.
Count how many times number 5 appears.
Example:
(1,5,3,5,7,5)
Output: 3
------------------------------------------------------------
8. Set (Medium)
Create two sets:
A = {1,2,3,4,5}
B = {4,5,6,7}
Print:
- Union
- Intersection
- Difference (A - B)
------------------------------------------------------------
9. Dictionary (Medium)
Create a dictionary:
Subject → Marks (3 subjects)
Print:
- Total marks
- Highest marks
------------------------------------------------------------
10. Dictionary + List (Hard)
Take 3 students name from user.
For each student:
- Take marks
- Store in dictionary
Then:
- Print all students
- Print topper name
------------------------------------------------------------
BONUS (Optional)
Make a mini result system:
- Ask name
- Ask 3 subject marks
- Store in dictionary
- Calculate total + average
- Print grade:
90+ → A
80+ → B
70+ → C
Below → Fail