Counting…
There are 80 houses in a neighborhood. There are a total of 18 dogs in the neighborhood, 30 houses do not have any pets. 20 houses have both cats and dogs. How many cats are there in this neighborhood ?
what do you need to learn ?
you should know , how to count and if you happen to count some of them twice, you need to subtract them.
p(AUB) = p(A) + p(B) — p (AnB).
There are 10 entities in here . cat, dog, house, me, nila , moon, skater, dancer, singer, coder.
Total number of houses = 80
Total number of dogs in this hood = 18
Total number of cats in this hood = ?
Houses that has both cats and dogs = 20
houses do not have any pets = 30
houses that have pets = 80–30 = 50
50 = ? + 18 — 20
Total number of cats = 52
me : Is my answer right ?
Nila : Nope , my answer is 48 cats.
me : Wait what ? Okay let me rewrite the problem again.
There are 80 houses in a neighborhood. There are a total of 20 dogs in the neighborhood, 30 houses do not have any pets. 18 houses have both cats and dogs. How many cats are there in this neighborhood ?
50 = ? + 20 — 18
Total number of cats in the neighborhood = 48.
Nila : Do you want to talk about expectations , long-run averages, data structures, design patterns or coconut husks ?
Me : May be another day.