- 1
Does anyone knows why this code fails 3 of the 5 test that the Challenge has?
HalloweenCandy Challenge https://code.sololearn.com/cFf0z2i7ATmr/?ref=app
6 Answers
+ 2
The challenge says that you should round up to the nearest whole number. You instead round also down.
Btw. ceiling makes your job easier:
import math
houses = int(input())
print(math.ceil(200.0 / houses))
0
Thanksss,I tried to made a "rounder"because I did'nt knew about ceil,so I guess my "rounder" must have a mistake.
0
If you follow the adjusment Rithea Sreng mentions, you cannot use >= 0. You have to use > 0 because you otherwise would even add 1 to e.g. 2.0. Also you have to substring behind the dot, not just the first one. Otherwise you could get something like 1.07, which would not match.