what's wrong in my code? please help. halloween candy | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what's wrong in my code? please help. halloween candy

https://www.sololearn.com/coach/4?ref=app what's wrong in my code? the last three test cases are locked and showing that my code had failed but the unlocked two show that my code had passed those those test cases. https://code.sololearn.com/cmhfgww9Il78/?ref=app

19th Jun 2021, 9:10 AM
Abdus Sattar
Abdus Sattar - avatar
3 Answers
+ 13
import math houses = int(input()) if houses >= 3: print(math.ceil((2/houses)*100)) https://www.sololearn.com/Discuss/2751150/?ref=app
19th Jun 2021, 9:22 AM
Simba
Simba - avatar
+ 5
Abdus Sattar What if houses is less than 3? You didn't print anything in this case. Use ceil instead of round and also do not check condition just do this: import math houses = int(input()) #if houses >= 3: print(math.ceil((2 / houses) * 100))
19th Jun 2021, 9:20 AM
A͢J
A͢J - avatar
+ 1
thanks Simba I didn't realize round UP means literally rounding UP until today. thanks again.
19th Jun 2021, 9:38 AM
Abdus Sattar
Abdus Sattar - avatar