Python Conditional Statement Programs
1. Write a program to check whether a number is positive, negative, or zero.
2. Write a program to check whether a number is even or odd.
3. Write a program to find the largest of two numbers.
4. Write a program to find the largest of three numbers using if-elif-else.
5. Write a program to check whether a person is eligible to vote or not.
6. Write a program to check whether a year is a leap year or not.
7. Write a program to check whether a character is a vowel or consonant.
8. Write a program to check whether a student has passed or failed. (Pass marks = 33)
9. Write a program to calculate bonus:
Salary > 50000 → 10% bonus
Otherwise → 5% bonus
10. Write a program to display grade according to marks:
90+ → A
75–89 → B
50–74 → C
Below 50 → Fail
11. Write a program to check whether a number is divisible by 5 and 11.
12. Write a program to check whether a person can get a driving license:
Age ≥ 18 → Eligible
Otherwise → Not Eligible
13. Write a program to check whether a triangle is valid or not using angle sum property.
14. Write a program to check whether a number is a 3-digit number or not.
15. Write a program to find the smallest among three numbers.
16. Write a program to calculate electricity bill:
Units ≤ 100 → ₹5/unit
Units > 100 → ₹8/unit
17. Write a program to check whether a character is uppercase or lowercase.
18. Write a program to check whether a number is divisible by both 2 and 3.
19. Write a program to calculate discount:
Purchase amount > 5000 → 20% discount
Otherwise → 10% discount
20. Write a program to input temperature:
Temp > 40 → “Hot”
Temp 20–40 → “Warm”
Below 20 → “Cold”