+ 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)
4 Antworten
+ 9
You need to import math and do math.ceil(percentage) instead of round,bc it says round up to the nearest whole number (:
+ 7
Mohammad Hosein Nosrati no problem, I'm glad I could help you 🔥
+ 2
Eacy [inactive]
Thank you
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)