Skip to content

Commit 75a9271

Browse files
committed
....
1 parent 0b177fe commit 75a9271

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

61.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Write a function called calculate_tax that takes 3 arguments: your age, salary, and current job designation.
2+
# Your first task is to take these arguments as user input and pass these values to the function.
3+
# Your second task is to implement the function and calculate the tax as the following conditions:
4+
# NO TAX IF YOU ARE LESS THAN 18 YEARS OLD.
5+
# NO TAX IF YOU ARE THE PRESIDENT OF THE COMPANY
6+
# No tax if you get paid less than 10,000
7+
# 5% tax if you get paid between 10K and 20K
8+
# 10% tax if you get paid more than 20K
9+
# Finally return this tax value. Then print the returned value in the function call.
10+
# Example1:
11+
# Input:
12+
# 16
13+
# 20000
14+
# Student
15+
# Function Call: calculate_tax(16, 20000, 'Student')
16+
# Output: 0
17+
# Example2:
18+
# Input:
19+
# 20
20+
# 18000
21+
# assistant manager
22+
# Function Call: calculate_tax(20, 18000, 'assistant manager')
23+
# Output: 900.0
24+
# Example3:
25+
# Input:
26+
# 20
27+
# 22000
28+
# assistant manager
29+
# Function Call: calculate_tax(20, 22000, 'Assistant manager')
30+
# Output: 2200.0
31+
# Example4:
32+
# Input:
33+
# 20
34+
# 122000
35+
# president
36+
# Function Call: calculate_tax(20, 122000, 'president')
37+
# Output: 0
38+
def calculate_tax(age, slry, job):
39+
if age <= 18:
40+
return 0
41+
elif job == "president":
42+
return 0
43+
elif slry < 10000:
44+
return 0
45+
elif slry>= 10000 and slry <= 20000:
46+
c = (5/ 100)* slry
47+
return c
48+
elif slry > 20000:
49+
d = (10/ 100) * slry
50+
return d
51+
print(calculate_tax(20, 22000, 'student'))

0 commit comments

Comments
 (0)