Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
Halloween challenge
This is my solution to the Halloween candy challenge in Python. It fails the last three tests and I can't figure out what's wrong. Please help. https://code.sololearn.com/c1gvPC6THDh6/?ref=app https://www.sololearn.com/coach/4?ref=app
2 ответов
+ 1
In this problem, you need to ROUND UP the answer to nearest integer. Round function sometimes rounds up. other times, it rounds down. In those last 3 cases, it is rounding down. Import math and use math.ceil() in place of round() in your code. Cheers
+ 1
I solved it by using math.ceil() to round up - round() was rounding to the closest integer, but the challenge says to round up.