When I run the below code it only runs the if statement even if the user input is "Good" or "Fantastic". I am not sure why the code is only running one of the functions. Any help would be appreciated!!
#Want to calculate the tip. Take the users input of the amount of the bill and then have 3 options for tips: ok service - 18%, good service - 20%, and fantastic service - 25%. Then add that to the bill.
Ok_Service = 0.18
Good_Service = 0.20
Fantastic_Service = 0.25
bill = int(input("How much did the dinner cost?"))
service = input("How was the service?")
if service == "Ok" or "ok":
tip_ok = bill*Ok_Service
print("The tip is", tip_ok)
print("Your total bill is", bill+tip_ok)
elif service == "Good" or "good":
tip_good = bill*Good_Service
print("The tip is", tip_good)
print("Your total bill is", bill+tip_good)
elif service == "Fantastic" or "fantstasitc":
tip_fantastic = bill*Fantastic_Service
print("The tip is", tip_fantastic)
print("Your total bill is", bill+tip_fantastic)
else:
print("I can't calculate the tip.")
Aucun commentaire:
Enregistrer un commentaire