Halloween candy last three | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Halloween candy last three

I get the first two, but not the last three. I saw in the discussion to use a function I haven't covered yet. I want to use what I have covered. This is my code: houses = int(input()) if houses >=3: prob = (2/houses) pct = (prob * 100) i = pct y = round(i,1) z = round(y) print (z) What am I missing?

18th Jan 2020, 9:13 PM
Aprielle
2 Answers
+ 1
During solving that coach I remember having some problems with rounding.
18th Jan 2020, 10:04 PM
Seb TheS
Seb TheS - avatar
0
houses = int(input()) #your code goes here dollar = 2 percentage = (dollar * 100) //houses percent = (dollar * 100) /houses if percentage < percent : percentage +=1 print (percentage )
7th Feb 2020, 10:46 AM
Lee Chester
Lee Chester - avatar