+ 1

# Hallowin candy solution

Can any one explain me how to solve these problem becuase I only able to correct first 2 problem and other are showing not correct I used round up method and 2*100/houses But still I am not able to complete the problem

7 Antworten

+ 1

Hear, the answer of the code the problem is not in the code but in rouding the value
Instead use math.ceil( )
Function that round the value
In round 20.1 become 20
But in ceil function 20.1 become 21 and that the answer
Code is here..
import math
houses = int(input())
#your code goes here
result= (2*100/houses)
print(math.ceil(result))

+ 6

Show your code

+ 6

hint: 2.1, 2.2, 2.3 ... houses doesn't make sense

+ 2

Your code does not produce the expected results. Why do you mark your post as "best"?

+ 1

I Hope you find your answers within this threads.
https://www.sololearn.com/discuss/3199552/?ref=app
https://www.sololearn.com/discuss/3066414/?ref=app
https://www.sololearn.com/discuss/2109425/?ref=app
https://www.sololearn.com/discuss/2103058/?ref=app

+ 1

houses = int(input())
#your code goes here
result= (2*100/houses)
print(round(result))

+ 1

It's a mistake sorry for that can you give code with explain why I my code not giving the answer