Please help me!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please help me!!

how can i discovered this problem with python??? 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

3rd Apr 2021, 3:44 AM
febrio pratama
febrio pratama - avatar
3 Answers
+ 6
Yes its basic maths if you know math then you would be knowing that we get 20% simply multiplying 20/100 to the given number So do same thing here and find the value and assign it to another variable and print it
3rd Apr 2021, 3:47 AM
Ayush Kumar
Ayush Kumar - avatar
+ 3
Just like the guy above me said. Use simple math, take this advantage of Python, in which simple math can be interpreted in a single line. A sample: total_value = 50 tip = (20 * total_value) / 100 print(tip) Try it out there, it'll give you an idea. Now just build your own solution!
3rd Apr 2021, 4:11 AM
philipep
philipep - avatar
0
total_value=50 Print(total_value*0.2)
3rd Apr 2021, 2:42 PM
Kamil El achkar
Kamil El achkar - avatar