+ 1
A confusion with the Halloween Candy problem from Code Coach
Can anybody tell me why this code is not working?below mentioned code is not working for test result 3,4&5. p = (2/houses)*100 b = p%1 if b<=0.5: p = p-b else: p = p-b+1 print(int(p))
11 Answers
+ 2
Rithea Sreng Thanks a lot lot lot. It worked <3
+ 2
oh! It is easy. I thought it would be complex. Thanks for clearing it up in seconds :D
+ 1
Rithea Sreng print(3.5%1) gives a output 0.5. So it won't be zero.
+ 1
But I have b>0
+ 1
Is there any way to know what was in test result 3,4&5?
+ 1
I have seen this solution in discussions. Now I have to learn how .ceil() works. Thanks ^_^