Please I need an explanation to solve this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please I need an explanation to solve this

When you go out to eat, you always tip 20% of the bill amount. But who’s got the time to calculate the right tip amount every time? Not you that’s for sure! You’re making a program to calculate tips and save some time. Your program needs to take the bill amount as input and output the tip as a float. Sample Input 50 Sample Output 10.0

16th Aug 2022, 12:44 PM
OLAMIDE
OLAMIDE - avatar
9 Answers
0
I had. Payment*0.2 is the key point, just like tax.
16th Aug 2022, 1:53 PM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar
+ 1
I cannot see any calculation in your code, you are just printing 20 on the screen.
16th Aug 2022, 1:51 PM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar
0
Total payment*0.2 is the tip amount, tricky point is that you need to output as float, or may be there is decimal points requirements.
16th Aug 2022, 1:39 PM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar
0
There is no decimal point required . Thats it
16th Aug 2022, 1:40 PM
OLAMIDE
OLAMIDE - avatar
0
bill = int(input()) tip = ("20") print(int("20")) I dont know where the mistake is coming from thou
16th Aug 2022, 1:42 PM
OLAMIDE
OLAMIDE - avatar
0
Thats why i need more explanation, if you can
16th Aug 2022, 1:52 PM
OLAMIDE
OLAMIDE - avatar
0
bill = int(input(20)) tip = (5*20\5) print(tip) It wAs said i got it but i should learn from my bug, what could be the issue
16th Aug 2022, 2:14 PM
OLAMIDE
OLAMIDE - avatar
0
Tip should be calculate by bill, not a arithmetic statement. There is no operand such as \ in Python (hope I am right, since it is normal use as escape tag but VB use it as floor division), / is division and // is floor division in Python, and you need not parentheses the arithmetic statement in Python, otherwise it may become a tuple…
16th Aug 2022, 3:24 PM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar
0
bill=int(input()) tip=((bill*20)/100) print(float(tip))
18th Aug 2022, 10:44 AM
Kailash Yandrapu