+ 3
If statements V learning Python
I have to output the remainder off money which is inputted, I have when I want to buy icecream for 10 of my friends, in four of five test cases it’s works but one that’s not shown fails. What did I do wrong? Thx for all helps :)) money = int(input()) price = int(input()) price *= 10 if money > 100: print() if money <= 100: print(money%price)
7 Réponses
+ 3
this works strangely :)
if price <= money:
print(money % price)
+ 2
This won't work when money is the double or more of the price*10.
For example money is 50 and price is 2.
50%20 outputs 10, whereas the desired output is 30.
BTW you don't need to print blank when money > 100
+ 2
maybe its a bug ?
+ 1
tried your code vinit creations but it still says that test case 4 is wrong :/
0
I have same problem tho hahaha
0
Same here. Test case 2 keeps saying it's wrong.