Tip calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Tip calculator

I wrote a code and output is ok. Bt code is wrong. bill = float(input("Enter your bill:")) print(bill) tip = float(input("Enter your tip %: ")) tip_amount = bill * 20 / 100 print(tip_amount)

11th Jun 2021, 11:09 AM
Youtuber
Youtuber - avatar
4 Answers
+ 1
Youtuber How output is OK if code is wrong? You just have to print result so remove whatever you have written in input() and also change to int from float.
11th Jun 2021, 11:19 AM
A͢J
A͢J - avatar
+ 1
# ok X= thanks Print(x)
11th Jun 2021, 11:39 AM
Youtuber
Youtuber - avatar
0
Youtuber the code prompts for input of the tip percentage and then uses a hard-coded value of 20 instead of the tip variable.
11th Jun 2021, 3:15 PM
Brian
Brian - avatar