0

Can anybody explain the logic in Halloween candy problem

I am trying to solve halloween candy problem in code coach but i dont understand the logic in the problem.please can anyone explain it

10th Feb 2021, 2:41 PM
Guraja Teja Surya Lokesh Kumar
Guraja Teja Surya Lokesh Kumar - avatar
3 Answers
+ 6
It's asking for the probability of getting money instead of candies. If you visit any number of houses 2 of those will always be money. So, to get the probability you have to divide 2 by the number of houses and multiply it by 100 to get the percentage which shoud be rounded up to the nearest whole number. Btw, math.ceil is used to round up. Guraja Teja Surya Lokesh Kumar Yup! you're on the track. Go ahead 🚀
10th Feb 2021, 3:09 PM
Simba
Simba - avatar
+ 1
Simba so we can visit n number of houses but only 2 will be dollar bills.Am i right
10th Feb 2021, 3:32 PM
Guraja Teja Surya Lokesh Kumar
Guraja Teja Surya Lokesh Kumar - avatar
+ 1
Simba thank you
10th Feb 2021, 3:43 PM
Guraja Teja Surya Lokesh Kumar
Guraja Teja Surya Lokesh Kumar - avatar