-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtax.py
More file actions
32 lines (25 loc) · 1.22 KB
/
tax.py
File metadata and controls
32 lines (25 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Accept user income as float (to allow decimal values)
income = float(input("Enter Your Income in INR: "))
# -----------------------------------------
# Define tax slab limits and rates
first_limit = 500_000 # First threshold (up to 5 lakhs is tax-free)
second_limit = 1_000_000 # Second threshold (10 lakhs)
first_rate = 0.10 # 10% tax rate on income above 5L up to 10L
second_rate = 0.20 # 20% tax rate on income above 10L
# Pre-calculate tax for income between 5L and 10L (fixed slab tax)
first_limit_tax = (second_limit - first_limit) * \
first_rate # 10% of 5L = 50,000
# -----------------------------------------
# Apply Tax Logic Based on Slabs
if income > second_limit:
# For income above 10L: Apply 20% on amount exceeding 10L
# Add fixed tax of 50,000 for income between 5L and 10L
tax = ((income - second_limit) * second_rate) + first_limit_tax
print("Your Tax Liability is INR:", tax)
elif income > first_limit:
# For income between 5L and 10L: Apply 10% on amount above 5L
tax = (income - first_limit) * first_rate
print("Your Tax Liability is INR:", tax)
else:
# For income up to 5L: No tax
print("You are exempt from Tax")