The "Halloween Candy" question in Code Coach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The "Halloween Candy" question in Code Coach

https://www.sololearn.com/coach/4?ref=app I have devoted almost an hour to solving this simple looking question but am still unable to get all the five code tests correct. It shows the code to be incorrect after two tests i.e. on the third one. Can someone please point out the mistake. This is my code: a=int(input()) b=(2/a)*100 print(round(b))

5th Apr 2021, 10:26 AM
Aman Singh
Aman Singh - avatar
2 Answers
+ 3
it says **round up** use math.ceil() instead of round()
5th Apr 2021, 10:28 AM
Slick
Slick - avatar
+ 1
Thanks Slick , it worked
5th Apr 2021, 10:59 AM
Aman Singh
Aman Singh - avatar