Tax Eligibility Check
Practice a two-condition income and age check in Python. Students trace strict thresholds and understand why this classroom rule is not real tax guidance.
1# Take income and age2income = float(input("Enter income (in lakhs): "))3age = int(input("Enter age: "))45# Check tax eligibility6if age > 18 and income > 5:7 print("Eligible for tax")8else:9 print("Not eligible for tax")
Output
Enter income (in lakhs): 6 Enter age: 25 Eligible for tax Enter income (in lakhs): 4 Enter age: 25 Not eligible for tax
In this one
- Combine strict thresholds
- Keep units explicit
- Distinguish exercises from policy
How it works
- 1
Read income in lakhs and age in years.
- 2
Check age above eighteen and income above five.
- 3
Print success only when both rules hold.
Edge cases
Does age 18 pass?
Does age 18 pass?
No. The comparison is > 18, not >= 18.
Does income 5 pass?
Does income 5 pass?
No. Income must be strictly greater than five.
What's going on
This is an invented eligibility rule for practicing and, not a statement of tax law. income is read in lakhs and age as a whole number.
The decision requires age above eighteen and income above five. Both tests are strict, so equality at either boundary fails. For income 6 and age 25, both pass; income 4 at the same age does not.
Does age 18 pass? No. The comparison is > 18, not >= 18.
Does income 5 pass? No. Income must be strictly greater than five.
Quiz
Tap an option. The answer stays hidden until you pick.
Question 1
Can one true condition be enough?
Pick an answer to check it.
Question 2
Does age 18 pass?
Pick an answer to check it.
Questions people ask
Does age 18 pass?
No. The comparison is > 18, not >= 18.
Does income 5 pass?
No. Income must be strictly greater than five.
Can one true condition be enough?
No, and requires both.
๐Related Content
- ๐
Phase 1 - Learn Concepts
Review Phase 1 concepts and explanations
- ๐
Phase 1 - Quiz
Test your Phase 1 understanding with quiz questions
- ๐ป
Phase 1 - All Practice Problems
Explore all practice problems for Phase 1
- ๐
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- ๐ง
Logic Building Overview
Learn about the complete logic building curriculum