Founding Batch Offer ยท HLD ยท LLD ยท System Design at โ‚น799 until 30 Nov

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.

IntermediatePhase 1 - Level 4: Logical Operators & Compound StatementsExample 5 of 10
tax-eligibility-check.py
1# Take income and age
2income = float(input("Enter income (in lakhs): "))
3age = int(input("Enter age: "))
4
5# Check tax eligibility
6if 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. 1

    Read income in lakhs and age in years.

  2. 2

    Check age above eighteen and income above five.

  3. 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.