forked from MrBlaise/learnpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtax.py
More file actions
29 lines (20 loc) · 607 Bytes
/
tax.py
File metadata and controls
29 lines (20 loc) · 607 Bytes
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
#!/usr/bin/env python3
# Tax calculator
# This program currently
# only works with the hungarian tax
def calcTax(cost, country='hungary'):
countries = {'hungary' : 27}
if country in countries.keys():
tax = (cost / 100) * countries[country]
else:
return "Country can't be found"
return tax
def main(): # Wrapper function
tax = calcTax(int(input('What was the cost of your purchase? ')),
input('Which country are you in? '))
if type(tax) == str:
print(tax)
else:
print('The tax on your purchase was:', tax)
if __name__ == '__main__':
main()