+ 1
Halloween candy
Не могу понять, в чем косяк https://sololearn.com/coach/4/?ref=app houses = int(input()) shans = round((2/houses)*100) print(shans)
3 Respuestas
+ 2
Владимир Ершов ,
since the task description says about output:
"A percentage value rounded up to the nearest whole number.",
we should use ceil() for rounding but not round(). to get access to ceil(), we have to import math module.
happy coding!
+ 2
Владимир Ершов ,
you are right: round() is rounding to the nearest whole number, but this can be rounding UP or rounding DOWN, depending on the value of the number.
but task description is talking about to apply a rounding UP, which means that ceil() is the correct way to go.
+ 1
Lothar thanks, but i thought, round() rounded to the ->nearest whole number<-. Hmm, mb translation mistake.