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
92 changes: 67 additions & 25 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"- 𝑃(𝐴∪𝐵)=0.6 >>> should be 0.8 \n",
"- 𝑃(𝐴∩(𝐵∪𝐵𝐶))=0.4 >>> should be 0.3 \n",
"- 𝑃(𝐴𝐶∩𝐵𝐶)=0.3 >>> should be 0.2\n",
"\n",
"\"\"\""
]
},
Expand All @@ -44,13 +45,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.3333333333333333\n",
"0.3448275862068966\n",
"0.39285714285714285\n",
"0.4\n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"#Taking a white ball out.\n",
"print(10/(10+12+8))\n",
"\n",
"#Taking a white ball out after taking a black ball out.\n",
"print((10/(10+12+7)))\n",
"\n",
"#Taking a red ball out after taking a black and a red ball out.\n",
"print((11/(10+11+7)))\n",
"\n",
"#Taking a red ball out after taking a black and a red ball out with reposition.\n",
"print((12/(10+12+8)))"
]
},
{
Expand All @@ -70,13 +90,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.125\n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"print((0.5*0.1)/0.4)"
]
},
{
Expand All @@ -102,28 +128,44 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Gender Total Yes No\n",
"0 Men 480 324 156\n",
"1 Women 520 351 169\n"
]
}
],
"source": [
"# your code here"
"import pandas as pd\n",
"\n",
"data = {\n",
" 'Gender': ['Men', 'Women'],\n",
" 'Total': [480, 520],\n",
" 'Yes': [324, 351],\n",
" 'No': [156, 169]\n",
"}\n",
"\n",
"df = pd.DataFrame(data)\n",
"print(df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"-Answer : They are independent, as P(Yes∩Man) = P(Yes)*P(Man) (both 0.324)."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -137,7 +179,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down