Halween Candy challenge in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Halween Candy challenge in Python

Hi guys, I have created the line correctly using round() function, and in the results both tests are correct ... however it asks me to try again... anyone can help me?

20th Aug 2021, 8:34 PM
Soad Afify
5 Answers
+ 3
Soad Afify , before we all have to guess, please post your attempt here. without having seen your complete code it is difficult to find out what the issue is. thanks!
21st Aug 2021, 6:06 AM
Lothar
Lothar - avatar
+ 2
Hello man, You can use the ceil function from the math module because the roud function approximates the nearest decimal number. Or you can add 0.5 and after using rounding function.
20th Aug 2021, 10:11 PM
Cesar Torres
Cesar Torres - avatar
0
I already tried ceil function but didn't work, now I tried the second option and worked find ... but I didn't understand why? can you plz explain? ... and Thanks for your support ☺️
20th Aug 2021, 10:16 PM
Soad Afify
0
Soad Afify i'm agree
21st Aug 2021, 6:08 AM
Cesar Torres
Cesar Torres - avatar
- 1
hey guys, this is my code after adding 0.5 dollar = 2 result = ((dollar *100)/houses)+0.5 print(round(result))
21st Aug 2021, 8:34 AM
Soad Afify