I'm trying to make a tip calculator and not sure why it's not working | Sololearn: Learn to code for FREE!
0

I'm trying to make a tip calculator and not sure why it's not working

def main(): price = input("How much did you pay?") tip = input("How good was your service? Poor, average or excellent?") if tip == "Poor": tip_percent = .10 * price if tip == "Average": tip_percent = .15 * price if tip == "Excellent": tip_percent = .20 * price print(f"The tip would be $%.2f " % (tip_percent)) main()

4th Sep 2021, 7:34 PM
BucketButter
BucketButter - avatar
1 ответ
+ 2
Input is always string by default. So you have to convert price to int or float.
4th Sep 2021, 7:42 PM
Simon Sauter
Simon Sauter - avatar