Someone please help me out with his code ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Someone please help me out with his code ?

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

27th Jun 2022, 5:13 PM
MAnny
MAnny - avatar
9 Answers
+ 4
I commented out all the lines to remove: bill = int(input()) #bill = 125 bill = bill*20 bill_2 = int(bill)/100 print(float(bill_2)) # You can remove int() and float() #real_bill = int(input()) #real_bill = 268 #real_bill = real_bill*25 #another_bill = int(real_bill)/125 #print(float(another_bill)) We are supposed to use the input(), do not hard-code the values!
27th Jun 2022, 5:24 PM
Lisa
Lisa - avatar
+ 1
@Lisa can you pls write out the correct result cause I'm really confused here.
27th Jun 2022, 5:28 PM
MAnny
MAnny - avatar
+ 1
Ben Rogers you're a genius, thank you.
27th Jun 2022, 5:41 PM
MAnny
MAnny - avatar
0
bill = int(input()) bill = 125 bill = bill*20 bill_2 = int(bill)/100 print(float(bill_2)) real_bill = int(input()) real_bill = 268 real_bill = real_bill*25 another_bill = int(real_bill)/125 print(float(another_bill)) This is my code and the result is correct but I think there must be mistake somewhere.
27th Jun 2022, 5:15 PM
MAnny
MAnny - avatar
0
print(int(input())*(20/100)) What about this one....
29th Jun 2022, 3:00 AM
Vamsi Krishna
Vamsi Krishna - avatar
0
bill = float(input()) bill*= 0.2 print(bill)
29th Jun 2022, 6:35 AM
Vinícius Almeida Alkmim
0
simply print(bill*20/100)
29th Jun 2022, 4:23 PM
Bealu girma
Bealu girma - avatar
- 1
This seems much more complicated than it needs to be for the test
27th Jun 2022, 5:25 PM
Ben Rogers
- 1
bill = float(input()) print (float(bill/5)) This code will work for the test, just needs to be a simple divide by 5 as this will give you 20%
27th Jun 2022, 5:32 PM
Ben Rogers