0
How do I round up following code? It's Halloween Candy challenge easy.
def prob(x): res = int(2/x*100) print(res) prob(int(input()))
4 odpowiedzi
+ 6
Hacker Badshah it is round "up" (math.ceil instead of round )
+ 2
"""Then you have to use math module
For rounding up
Like this:"""
import math
houses = int(input())
chance = ((2/houses)*100)
print(math.ceil(chance))
0
Then 66.6666 sounds down to 66, not 67.
0
The math.ceil worked but only after I changed the first integer call to a float.