- 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
9 Respuestas
+ 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!
+ 1
@Lisa can you pls write out the correct result cause I'm really confused here.
+ 1
Ben Rogers you're a genius, thank you.
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.
0
print(int(input())*(20/100))
What about this one....
0
bill = float(input())
bill*= 0.2
print(bill)
0
simply
print(bill*20/100)
- 1
This seems much more complicated than it needs to be for the test
- 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%