+ 1

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 ti

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

28th Jan 2022, 3:18 PM
mahendra nag
mahendra nag - avatar
17 Antworten
+ 4
Your code must meet the conditions in the task description to solve the task: only input as described and only output as described
28th Jan 2022, 5:23 PM
Lisa
Lisa - avatar
+ 1
Please show your code so we can help you to solve the task
28th Jan 2022, 3:27 PM
Lisa
Lisa - avatar
0
Your calculation is currently a string – remove '' to output the result
28th Jan 2022, 3:30 PM
Lisa
Lisa - avatar
0
Please explain briefly
28th Jan 2022, 3:31 PM
mahendra nag
mahendra nag - avatar
0
I am a beginner
28th Jan 2022, 3:31 PM
mahendra nag
mahendra nag - avatar
0
Remove the '' to output the number. print() is a function not a variable, so it is print(something)...
28th Jan 2022, 3:35 PM
Lisa
Lisa - avatar
0
Read the task description again: input is bill, there isn't any 2nd input. print is a function to print the result and remove the ' inside of print()
28th Jan 2022, 3:44 PM
Lisa
Lisa - avatar
0
Please read the task description and my comments carefully. If you still have problems, show us your updated code.
28th Jan 2022, 4:11 PM
Lisa
Lisa - avatar
0
Hi mahendra nag, I think you didn't learnt the Python syntaxes clearly, In your code you have wrote to take first input as bill okay it's right Now no need to take second input as it's given that's the tip is 20%, the user don't have to input the tip, so correct it Now you are doin print = ... (?!?!) As said by Lisa print is a function not a variable So remove the '=' sign and (' ') After doing these things, you will surely pass the test cases
28th Jan 2022, 4:46 PM
NEZ
NEZ - avatar
0
mahendra nag Why are you taking the bill in as an int? What if the bill was $15.75... It's better to cast it as a float. And why are you casting the tip amount twice? That doesn't make logical sense. If you're going to take in different tip percentages, just cast it once. You're also missing a ) on that line. Your print line is also wrong. You're just outputting 'bill*20/100'. It's not actually calculating anything. And why are you taking in the tip percentage if you're not actually using it in the equation? You need to remove the single quotes, or format it with either string format, or f string. So, something like print('{amount:.2f}'.format(amount = bill * (tip / 100))) Or print(f'{bill * (tip / 100)}')
28th Jan 2022, 6:50 PM
Benjamin Rogers
Benjamin Rogers - avatar
0
Ade Rash You don't need to cast tip to a float in the print, the division operator returns a float. So you can just do print(tip).
29th Jan 2022, 6:43 AM
Benjamin Rogers
Benjamin Rogers - avatar
- 1
bill = int(input()) tip = float(int(input()) print = ('bill*20/100')
28th Jan 2022, 3:29 PM
mahendra nag
mahendra nag - avatar
- 2
Please try it and send
28th Jan 2022, 3:41 PM
mahendra nag
mahendra nag - avatar
- 2
No bro its showing error
28th Jan 2022, 3:51 PM
mahendra nag
mahendra nag - avatar
- 2
Please help
28th Jan 2022, 3:51 PM
mahendra nag
mahendra nag - avatar
- 3
Nope u r wrong
28th Jan 2022, 3:41 PM
mahendra nag
mahendra nag - avatar
- 3
I thought problem was in my code... but the real problem is with this app... my codes worked fine in python...
28th Jan 2022, 5:18 PM
mahendra nag
mahendra nag - avatar