0

I am trying to solve halloween candy problem from the community option.So why my code is not working pls anybody help.

houses = int(input()) #your code goes here if houses>=3: x=(2/houses)*100 y=round(x) print(y) else: print("0")

25th Oct 2021, 1:19 PM
Vaibhav Tiwari
11 Answers
+ 2
Cause you need to round up and for that you will need to use the math.ceil() function import math #replace the round(x) math.ceil(x) Hope this helps!
25th Oct 2021, 2:14 PM
Abdulaziz Al-Shehhi
Abdulaziz Al-Shehhi - avatar
0
Can u plz define the question for dat program?
25th Oct 2021, 2:00 PM
Jolen Mascarenhas
0
Thanks it worked but I don't understand why the round (x) didn't work
25th Oct 2021, 2:27 PM
Vaibhav Tiwari
0
Actually round(x) worked for 1st two test but It didn't work for the hidden tests
25th Oct 2021, 2:31 PM
Vaibhav Tiwari
0
Oh...
25th Oct 2021, 2:31 PM
Jolen Mascarenhas
0
You need to round up but the round function will not always round up. It rounds to the nearest integer. For example: round(2.6) = 3 But, round(2.4) = 2
25th Oct 2021, 2:36 PM
Abdulaziz Al-Shehhi
Abdulaziz Al-Shehhi - avatar
0
☝️ that's called round up 🤦
25th Oct 2021, 2:37 PM
Jolen Mascarenhas
0
Oh
25th Oct 2021, 2:38 PM
Vaibhav Tiwari
0
Use math.ceil() instead of round()as he told
27th Oct 2021, 12:32 PM
Vaibhav Tiwari
- 1
Round(x,0) ?? Idk but just try
25th Oct 2021, 2:28 PM
Jolen Mascarenhas