- 2
Whar am I doing wrong
Everything I try is wrong Explanation: 20% of 50 is 10. To calculate 20% of a given amount, you can multiply the number by 20 and divide it by 100: 50*20/100 = 10.0 bill = int(input(50)) tip = input('10') x= bill y= tip print('x'*20/100)
2 Antworten
+ 2
If you were to type:
input(50)
by itself with nothing else, youll see a big flaw with your code. Its outputting 50 regardless of what you do. Try:
bill = input() #nothing inside the input, then type it after you run your code.
or
bill = 50
there is a couple other problems with your code, but this will help you get on the right track.
+ 1
Daniel Anderson
Inside single or double quotes anything would be known as string so
'x' is a string not a variable
print (x * 20 / 100)
#x is integer input
20% of 50 is just an example to understand concept don't use that in your code