0

Can someone pls help me with a doubt in the code - halloween candy

I have gone through many codes for this problem and almost everyone has used the logic like b=(2/a) *100 But I don't understand that why do we need use the line 2/a... because it's not mention that we must have in the bag 2 dolar bills,there might be possibility of 1or 0 dolar bills too in the bag, then how can we use this line in our code. Plss help me out with this logic. https://code.sololearn.com/cBWft4HuOFK3/?ref=app

21st Aug 2020, 9:16 AM
Rounak Raj Singh
6 Answers
+ 1
https://code.sololearn.com/ck86nSEV9tRy/?ref=app
21st Aug 2020, 9:47 AM
The_Fox
The_Fox - avatar
+ 1
I also did not use that line... Maybe that will help (just another idea). :)
21st Aug 2020, 9:47 AM
The_Fox
The_Fox - avatar
+ 1
Indirectly u also used the same term only right bcoz 2 will come up so it becomes 2*100/houses....my doubt is why are we writing 2 here
21st Aug 2020, 9:54 AM
Rounak Raj Singh
0
Bcoz as per my knowledge of probability the term on top is the quantity that we have but in this case we are not sure about the number of dolar bills in the bag, so then why are we using 2 in the numerator?
21st Aug 2020, 9:56 AM
Rounak Raj Singh
0
I‘m pretty sure it‘s because „two houses are giving out dollar bills“, hence the 2.
21st Aug 2020, 2:59 PM
The_Fox
The_Fox - avatar
0
Okhh...
21st Aug 2020, 3:37 PM
Rounak Raj Singh