Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def main():
- subtotal = float(input('How much was the bill? '))
- service = input('How was the service? (b)ad/(a)vg/(g)ood: ')
- t = calcTotal(subtotal,service)
- print(f'The bill is ${t:.2f}. Thank you!')
- def calcTotal(st, svc):
- if svc == 'b':
- tip = .02
- elif svc == 'a':
- tip = .20
- elif svc == 'g':
- tip = .30
- else:
- print('Invalid option')
- sys.exit(1)
- total = st * (1+tip)
- return total
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement