- 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

8th May 2020, 6:28 AM
Kevinator
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))
8th May 2020, 6:38 AM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
0
Thanksss,I tried to made a "rounder"because I did'nt knew about ceil,so I guess my "rounder" must have a mistake.
8th May 2020, 6:43 AM
Kevinator
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.
8th May 2020, 7:49 AM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar