0

Tip Calculator Project (Python for beginners)

My sample input is always 125, why could this be? I’ve got hold of the sample output but i’m stuck with the input. Anyone got some tips? Here is my code: bill = int(input()) x = "50" y = int(x) * int("20") z = int(y) / int("100") print (z) Im new don’t laugh at me ;-;

14th Nov 2021, 11:34 AM
Undercover Gamer
2 odpowiedzi
+ 2
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 1.The question requires 1 input. 2. Then you create another variable, that will do the calculations (in this you will multiply the 20% in the question by the input and divide it by 100(We divide it by 100 because a percentage was given in the question above) 3. Then you convert the second variable to a float. bill = int(input()) tip = 20 * bill / 100 print(float(tip))
14th Nov 2021, 12:02 PM
MATOVU CALEB
MATOVU CALEB - avatar
0
Wow thanks! I understand how the process works now.
15th Nov 2021, 11:41 PM
Undercover Gamer