Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 40 additions & 14 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"# 1 . 𝑃(𝐴∪𝐵) = 𝑃(𝐴) + 𝑃(𝐵) - 𝑃(𝐴∩𝐵) = 0.3 + 0.6 - 0.1 = 0.8\n",
"#2. 𝑃(𝐴𝐶∩𝐵𝐶) = 1 - 𝑃(𝐴∪𝐵) = 1 - 0.8 = 0.2"
]
},
{
Expand All @@ -48,9 +47,10 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"# 10/30 = 0.33\n",
"#9/29= 0.31\n",
"#11/28=0.39\n",
"#12/30=0.4"
]
},
{
Expand All @@ -74,9 +74,7 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"#Picnic = (0.50 * 0.10) / 0.40 = 0.125"
]
},
{
Expand All @@ -102,11 +100,39 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 99,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Probability of answering 'yes': 0.675\n",
"Probability of being a man: 0.48\n",
"Conditional probability of answering 'yes' given being a man: 0.675\n",
"The events are independent\n"
]
}
],
"source": [
"# your code here"
"total_men = 480\n",
"yes_men = 324\n",
"total_women = 520\n",
"yes_women = 351\n",
"total_responses = total_men + total_women\n",
"total_yes = yes_men + yes_women\n",
"P_yes = total_yes / total_responses\n",
"P_men = total_men / total_responses\n",
"P_yes_given_men = yes_men / total_men\n",
"if abs(P_yes - P_yes_given_men) < 0.01: \n",
" independence = \"independent\"\n",
"else:\n",
" independence = \"dependent\"\n",
"\n",
"print(\"Probability of answering 'yes':\", P_yes)\n",
"print(\"Probability of being a man:\", P_men)\n",
"print(\"Conditional probability of answering 'yes' given being a man:\", P_yes_given_men)\n",
"print(\"The events are\", independence)"
]
},
{
Expand All @@ -123,7 +149,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -137,7 +163,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.10.9"
}
},
"nbformat": 4,
Expand Down