File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
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' ))
You can’t perform that action at this time.
0 commit comments