Tax Eligibility Check

Take income and age, and check if eligible for tax (age > 18 and income > 5 L).

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

What's going on

Use AND to check both conditions.

Key Concepts:

Age must be > 18
Income must be > 5 lakhs
Both conditions must be true