📝 Python Practice Worksheet
Topic: If/Elif/Else, Match, For Loop, While Loop
Part A: If / Elif / Else
Q1: Age Group Classifier
Write a program that asks the user for their age.
- If age ≤ 12 → "You are a child."
- If 13–19 → "You are a teenager."
- If 20–59 → "You are an adult."
- If ≥ 60 → "You are a senior citizen."
Q2: Temperature Checker
Write a program that asks the user for the temperature (°C).
- Below 15 → "It’s cold."
- Between 15–30 → "It’s warm."
- Above 30 → "It’s hot."
Part B: Match (Python 3.10+)
Q1: Traffic Light System
Ask the user for a traffic light color (red, yellow, green) and print the correct action.
Q2: Grade Meaning
Ask the user for a letter grade (A, B, C, D, F) and print the meaning (e.g., Excellent, Good,
etc.).
Q3: Shape Sides
Ask the user for a shape name (circle, square, triangle) and print how many sides it has.
Part C: For Loop
Q1: Counting Numbers
Use a for loop to print numbers from 1 to 10.
Q2: Multiplication Table
Ask the user for a number and print its multiplication table up to 10.
Q3: Even Numbers
Write a program that prints all even numbers from 1 to 50.
Part D: While Loop
Q1: Counting with While
Use a while loop to print numbers from 1 to 10.
Q2: Exit Program
Keep asking the user for input. Stop only when they type "exit".
Q3: Password Checker
Keep asking the user for the password until they enter "python123".