Python Conditional Program Questions
1. Check if a number is positive, negative, or zero
👉 Determine the sign of a number using if-elif-else.
2. Check if a number is even or odd
👉 Use the modulus operator to test if a number divides evenly by 2.
3. Find the greatest of two numbers
👉 Compare two values and print which one is larger.
4. Find the greatest of three numbers
👉 Compare three values using logical and relational operators.
5. Check if a year is a leap year
👉 Apply leap year conditions: divisible by 4, not 100 unless also divisible by 400.
6. Check if a character is a vowel or consonant
👉 Test if a given letter belongs to the vowel set (a, e, i, o, u).
7. Check if one number is a multiple of another
👉 Determine if the first number divides exactly by the second.
8. Create a simple calculator using if-else
👉 Perform addition, subtraction, multiplication, or division based on the operator entered.
9. Check if a number is within a given range
👉 Use comparison operators to verify if a number lies between two limits.
10. Check if a person qualifies for a discount
👉 Apply conditional rules like age or total amount to decide eligibility.
11. Check if a character is uppercase, lowercase, digit, or special character
👉 Use string functions (isupper(), islower(), etc.) to classify the input.
12. Check if a person is eligible to vote
👉 Use age-based condition to check if a person is 18 or older.
13. Check if a number is divisible by both 3 and 5
👉 Verify that the number gives zero remainder for both 3 and 5.
14. Check if a triangle is valid based on its angles
👉 A triangle is valid only if the sum of its angles equals 180°.
15. Grade a student based on marks
👉 Assign grades (A–F) based on score ranges using elif conditions.