Practice Python if‑elif‑else statements with beginner-friendly exercises. Strengthen your understanding of conditional logic, syntax, and control flow with hands-on coding problems.
Topic: if-elif-else
Write a program that prints the numbers from 1 to n. - But for multiples of 3, print "Fizz" instead of the number - and for the multiples of 5, print "Buzz". - For numbers which are multiples of both 3 and 5, print "FizzBuzz".
15
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Write a program to check if a number is positive, negative, or zero.
-5
Negative
Write a program to check if a number is even or odd.
7
Odd
Write a program to find the largest of three numbers.
5
9
2
9
Write a program to assign grades based on the score: - A (90-100) - B (80-89) - C (70-79) - D (60-69) - F (<60)
85
B
Write a program to classify age into: - Child (0-12) - Teenager (13-19) - Adult (20-64) - Senior (65+)
25
Adult
Write a program to describe the temperature: - Hot (>30°C) - Warm (20-30°C) - Cold (<20°C)
25.5
Warm
Write a program to check if a person is eligible to vote (18+ years).
17
Not eligible
Write a program to check the strength of a password: - Weak (length <6) - Medium (6-10 characters) - Strong (>10 characters)
password123
Strong
Write a program to print the day of the week based on a number (1-7).
3
Wednesday
Write a program to calculate the discount on a product: - 10% if price >=1000 - 5% if price >=500 - No discount otherwise
750
712.5
Write a program to check if a character is a vowel or consonant.
E
Vowel
Write a program to check if three given lengths can form a triangle. (Sum of any two sides must be greater than the third)
3
4
5
Valid triangle
Write a program to check if a number is a multiple of five.
25
Multiple of five
Write a program to check if an alphabet is uppercase or lowercase.
H
Uppercase
Write a program to check if a year is a leap year or not. A leap year is divisible by 4, but not by 100 unless also divisible by 400.
2020
Leap year
Write a simple calculator program that performs: - Addition (+) - Subtraction (-) - Multiplication (*) - Division (/)
5
2
/
2.5
Write a program to calculate BMI and categorize: - Underweight (<18.5) - Normal (18.5-24.9) - Overweight (25-29.9) - Obese (30+)
1.75
70
Normal
Write a program to check the type of a triangle: - Equilateral (all sides equal) - Isosceles (two sides equal) - Scalene (all sides different)
5
5
5
Equilateral
Write a program to print the number of days in a given month (1-12). Assume February has 28 days (ignore leap years).
4
30