If statements V learning Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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)

16th Sep 2020, 8:52 AM
Max (iHaZe)
Max (iHaZe) - avatar
6 Answers
+ 3
this works strangely :) if price <= money: print(money % price)
16th Sep 2020, 9:26 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 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
16th Sep 2020, 9:19 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
maybe its a bug ?
16th Sep 2020, 10:20 AM
Max (iHaZe)
Max (iHaZe) - avatar
+ 1
tried your code vinit creations but it still says that test case 4 is wrong :/
16th Sep 2020, 10:19 AM
Max (iHaZe)
Max (iHaZe) - avatar
0
I have same problem tho hahaha
30th Nov 2020, 12:51 PM
Novian
Novian - avatar
0
Same here. Test case 2 keeps saying it's wrong.
18th May 2021, 4:15 AM
Frank