I solved Holloween candy code coach using python but there is a problem in exactly those test cases that I can't see! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I solved Holloween candy code coach using python but there is a problem in exactly those test cases that I can't see!

It seems too easy on first sight, I used this code and just firat 2 tese cases are correct: houses = int(input()) percentage = (2/houses)*100 a = round(percentage) print(a)

30th Nov 2020, 9:17 PM
Mohammad Hosein Nosrati
Mohammad Hosein Nosrati - avatar
4 Answers
+ 9
You need to import math and do math.ceil(percentage) instead of round,bc it says round up to the nearest whole number (:
30th Nov 2020, 9:22 PM
🔥EACY🔥
🔥EACY🔥 - avatar
+ 7
Mohammad Hosein Nosrati no problem, I'm glad I could help you 🔥
30th Nov 2020, 9:25 PM
🔥EACY🔥
🔥EACY🔥 - avatar
+ 2
Eacy [inactive] Thank you
30th Nov 2020, 9:24 PM
Mohammad Hosein Nosrati
Mohammad Hosein Nosrati - avatar
0
Here you go. import math houses = int(input()) bhouses = 2 #your code goes here def count(x): if(x>=3): percent = math.ceil((bhouses / x) * 100) print(percent) else: return 0 count(houses)
21st Apr 2021, 6:38 AM
Joe Hutchens
Joe Hutchens - avatar