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
3 odpowiedzi
+ 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 🚀
+ 1
Simba so we can visit n number of houses but only 2 will be dollar bills.Am i right
+ 1
Simba thank you