+ 1
Help me with stage 20 in python learning.
I'm stuck in stage 20 and cant solve the question (tip calculator), I didn't get it. that's mean I am not smart at all?!đ
10 Respostas
+ 5
Share your tried code link here with saving .. Along with full question..
+ 3
your program should work on various inputs.. Take input into bill
bill = float( input() )
+ 1
hello again. thats the question. 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
what the question wants? I can't get that. I write code like this:
bill=50
print(20*float(bill)/100)
but the answer section is tripartite, and it says try again.
my english is terrible, so forgive me for my mistakes.
+ 1
thank you friend. god bless you.
+ 1
First you need to get the bill as input from the user:
bill = float(input())
Then you can calculate the tip based on the bill:
tip = bill*20/100
And that's it! Now you only have to output it:
print(tip)
The problem with your code was, that you didn't take a flexible bill (input()), but rather always set bill to be 50
The way you calculated the tip in the print statement is correct tho (I think)
Hope I could help!
0
You're welcome..
0
Share your code link buddy
0
hello. thank you for answering. actually I am new in this app. just three or four days. how to share my code link?
0
thanks a lot pal. yeah, you right. I think that's why the answer is tripartite. thanks again. best wishes.đ
0
You're welcome!