+ 1
Lesson 18 pyton beginners
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
8 Respuestas
+ 1
Thank you so much
0
What is the problem? Pls Add clear details...
edit:
Mario Fiorino
code for this :
50*20.0/100=10.0
https://www.sololearn.com/Discuss/2975875/?ref=app
if not solved, pls post your try here!!
0
1. Take input as float
2. Calculate the 20% of it
3. Print the calculated amount in 'float'
0
bill = int(input())
tip=("100÷50%20")
print("x")
#your code goes here
0
I'm trying this
0
Mario Fiorino
Why giving the output between " "??
It will always print the value: x
And why printing x??
When you have taken tip = ...
Then why printing x??
1.Remove the "" from your code
2. To calculate 20% we do like this:
(20/100)*50
(if we want to calculate 20% of 50)
You have to just change the value from 50 to 'bill'.
And use this:
print(tip)
//
If you will get any problems again, then alert us
0
bill = int(input()) #input is may be float,
tip=("100÷50%20") " This is just a string, don't put in quotes "", and in systems / is the division symbol, not ÷
But you need to take input 'bill' , into calculations
So
tip = bill*20/100
#print("x") #this prints string x only, print tip
print(tip)
#put all together, take input as float, instead of int type bill=float ( input() )
0
I really appreciate it