FAQ: Why Data Science? - Probability

This community-built FAQ covers the “Probability” exercise from the lesson “Why Data Science?”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Data Science Foundations
Data Scientist: Inference Specialist
Data Scientist: Machine Learning Specialist
Data Scientist: Natural Language Processing Specialist
Data Scientist: Analytics Specialist

FAQs on the exercise Probability

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in Language Help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

Looking for motivation to keep learning? Join our wider discussions in Community

Learn more about how to use this guide.

Found a bug? Report it online, or post in Bug Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

It seems like the code output always has a same birthday with person 1-10. Is there a reason why? It seems too often that a shared birthday has a person 1-10 and then some other person. eg person 2 and person 88 share a birthday.

Is this by design?

Are there months and days birthdays are more likely to occur, or are we assuming every day of the year has an equal chance of being someone’s birthday? Maybe I have a misunderstanding of probability or the simulate.py code but an 89% probability of two people sharing a birthday in a group of 40 people seems really high unless some days are weighted heavier than others.

1 Like

I don’t know if it is by design (since any simulation that doesn’t take real date into account isn’t going to be correct anyway) but

IMHO the simulation is strictly speaking not correct. Since it assigns all months the same probability irrespective of how many days they contain.

I would prefer to simply “roll 365-sided dice” several time

1 Like

I am a total beginner with no previous coding experience. Curiously, I opened the pycache folder, inspected the simulate.py file (which I believe contained the whole code), and noticed that “num_people_in_room = 2” in line 5 of script.py does not appear anywhere in simulate.py (although it seems to be defined in lines 33 and 35 of simulate.py file). How then are the two files (script.py and simulate.py) related or is there no link? Sorry for the seemingly dumb question, I just want to understand the coding context!

@augustkade6693427971 I agree. My probability for 30 people was 70.63% which seems really high as well. Although I don’t know for sure, I’m sure the random quality (there’s a different word for it than ‘quality’) is truly random. I highly doubt the organization would give us an example like that if it truly wasn’t random. But probability is funny when you think about it without doing the math, which is why Vegas always wins.

2 Likes