{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### <center>San Jose State University<br>Department of Applied Data Science</center>\n",
    "#  <center>DATA 220<br>Mathematical Methods for Data Analysis</center>\n",
    "### <center>Spring 2021<br>Instructor: Ron Mak</center>\n",
    "#  <center>Assignment #4<br>Combinatorics and Probability Problem Set</center>\n",
    "#### <center>100 points total<br>(10 points each, except PROBLEM 9 is 20 points)<br><br>Work together with your lab partner.<br>Write your solutions in one or more cells after each problem.<br>You can compute by hand, but try use Python code and Python functions.<br>You can add your own functions or other support code.<br>Explain your code with comments and print intermediate values from your calculations.</center>\n",
    "#### <center>Due February 25, 2021 at 5:30 PM</center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 1.</strong> You stand on a street corner and record the gender of the first ten people who pass by. If the city is half male and half female, what is the probability that you will record all females?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 2.</strong> What is the probability that a randomly selected leap year contains 53 Sundays?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 3.</strong> A group of ten friends randomly sit around a circular table. Two of them, Romeo and Juliette, love each other dearly. What is the probability that they end up sitting together?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 4.</strong> How many sums of money can you obtain by choosing two coins from a box that contains a penny, a nickel, a dime, a quarter, and a half dollar?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 5.</strong> You have three empty boxes and seven balls. How many ways can you distribute the balls among the three boxes so that each box contains at least one ball?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 6.</strong> A class has six boys and nine girls. Any two boys will fight if they're next to each other. How many ways can the teacher line up the students so that no two boys stand next to each other?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 7.</strong> A fastfood restaurant sells children's meal boxes. Each box randomly contains one of five different toys. All the toys are equally likely. What is the probability that if you buy five meal boxes, you will collect all five toys at once?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 8.</strong> You draw one card randomly from a standard deck of 52 playing cards (no jokers):\n",
    "\n",
    "<ul>\n",
    "    <li>Event A: You draw a heart card.</li>\n",
    "    <li>Event B: You draw a card that is not a face card.</li>\n",
    "    <li>Event C: You draw a non-face card that is divisible by 3.</li>\n",
    "</ul>\n",
    "\n",
    "#### What is the probability that Event A, B, or C will occur?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <strong>PROBLEM 9.</strong> [20 points] Empirically verify the probability that you calculated in Problem 8 with a Python program that simulates drawing randomly from a deck of cards. Initialize a list of cards, each card with a suit and a value. For each trial, generate a random number 0 through 51 in order to pick a card from the list, and check whether any of the events occurred. Do one million trials. After trial 100; 1,000; 10,000; 100,000; and finally 1,000,000, print the proportion of the trials so far where Event A, B, or C occured. How well does the proportion approach the probability you calculated in Problem 8 as the number of trials increases? Determine approximately how many trials are needed for the proportion to match your calculated probability to 3 decimal places."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
