+ 1
Python for beginners
Please can someone explain how to solve this 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.
4 Antworten
0
* get input
* convert input to a numeric data type
* calculate 20% of this
* output the result
0
I did this and it was still an error
bill = float(input(1000 * 20/100))
Print(bill)
0
input() takes user input – do not write inside of this function!
First take input and convert it, THEN calculate with it:
bill = float(input()) * 0.2
Also, I don't understand why you put 1000 there? 20% means 20/100 or 0.2
0
Thank you Lisa