A lot of cell phones have tip calculators. Write one. Ask the user for the price of the meal and the percent tip they want to le | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A lot of cell phones have tip calculators. Write one. Ask the user for the price of the meal and the percent tip they want to le

What the problem in this code? h = int(input('Enter the price of meal : ')) i = int(input('Enter the percent of tip you wana leave : ')) t=(h/i)*100 j = h + t print('Bill of meal : ', h, 'Total bill : ' , j)

18th May 2022, 4:56 PM
Muhammad Rehan
Muhammad Rehan - avatar
13 Answers
+ 1
# Hi! You can try this one: h = int(input('Enter the price of meal : ')) i = int(input('Enter the percent of tip you wana leave : ')) t = h * (i/100) j = h + t print('Bill of meal : ', h, 'Total bill : ' , j)
18th May 2022, 6:08 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Lisa From what I gather from the topic header. The task is to make a tip calculator. It must ask the user for the price of the meal. And the percentage of tip they want to offer.
18th May 2022, 6:30 PM
Chris Coder
Chris Coder - avatar
+ 1
Chris Coder The "description" is cut off. I asked because if it is a sololearn task or something, the output strings need to be exact.
18th May 2022, 6:59 PM
Lisa
Lisa - avatar
+ 1
Lisa my output is not accurate. My code doesn't calculate the percentage of tip.
19th May 2022, 9:07 AM
Muhammad Rehan
Muhammad Rehan - avatar
+ 1
Muhammad Rehan your tip equation is wrong. it should be: t=h*i/100 are you sure Per Bratthammar 's code is not working? it looks ok to me. Maybe you got the tip and price mixed up in your input?
19th May 2022, 9:52 AM
Bob_Li
Bob_Li - avatar
+ 1
Muhammad Rehan what error are you getting? If you corrected the tip calculation, in Sololearn you input like this: first line is price, second line is tip. 10 5 submit it should give you the result 10.5
19th May 2022, 10:07 AM
Bob_Li
Bob_Li - avatar
0
What is the task? Please provide the complete description with example input and output.
18th May 2022, 5:00 PM
Lisa
Lisa - avatar
0
Lisa I see thanks. Understood.
18th May 2022, 7:02 PM
Chris Coder
Chris Coder - avatar
0
محتاج كود رسم مربع برنامج تيربو بس يكون الناتج مال الرسم ملون
19th May 2022, 8:32 AM
Ali Qais
0
Lisa its not a solo learn task.
19th May 2022, 9:06 AM
Muhammad Rehan
Muhammad Rehan - avatar
0
Per Bratthammar not working your code
19th May 2022, 9:07 AM
Muhammad Rehan
Muhammad Rehan - avatar
0
Bob_Li Per Bratthammar code give error
19th May 2022, 10:02 AM
Muhammad Rehan
Muhammad Rehan - avatar
0
Nothing
20th May 2022, 1:49 AM
MULUKEN ADDIS
MULUKEN ADDIS - avatar