Advertisement
asgfgh

Restaurant bill calculator

Jun 15th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. #This is a program that calculates how much your total restaurant bill is going to be when taking the meal cost, tip percentage, and tax percentage into factor.
  2.  
  3. def bill():
  4.   try:
  5.     meal_cost = float(input('Meal cost?\n'))
  6.     tip_percent = float(input('Tip percent?\n'))
  7.     tax_percent = float(input('Tax percent?\n'))
  8.     total_cost =  float(round(meal_cost + tip_percent/100 + meal_cost * tax_percent/100))
  9.     print("The total cost is: " + str(total_cost))
  10.   except:
  11.     if input != float:
  12.       print('Invalid input, please enter a number.')
  13.  
  14. bill()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement