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")
11 Respuestas
+ 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!
0
Can u plz define the question for dat program?
0
Thanks it worked but I don't understand why the round (x) didn't work
0
Actually round(x) worked for 1st two test but It didn't work for the hidden tests
0
Oh...
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
0
☝️ that's called round up 🤦
0
Oh
0
Use math.ceil() instead of round()as he told
- 1
Round(x,0) ?? Idk but just try