- 2

Tipe calculator

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

16th Jan 2022, 9:56 PM
Sohail Charef
Sohail Charef - avatar
3 Answers
+ 1
Hi Sohail Here is the math: bill*1.2 - bill E.g. 50*1.2 = 60 60 - 50 = 10 <- your tip
16th Jan 2022, 10:02 PM
Ollie Q
Ollie Q - avatar
0
# one simple way would be: bill = float ( input ( ) ) p = 20.0 #percentage tip = bill * p / 100.0 print ( round ( tip, 1 ) ) # 1 decimal figure
17th Jan 2022, 12:12 AM
Christina Ricci
Christina Ricci - avatar
0
You should have given your code to us to check where you were wrong. But lemme explain you in detail:- You have to input any number Then print the 20% of it (as float). Like: Input-: 50 Output-: 10.0 It's a two/one-liner code to do, show us your code so that we can help you in debugging it.
17th Jan 2022, 4:10 AM
NEZ
NEZ - avatar