From e432704f667590dfe5ca82981429d24382945a59 Mon Sep 17 00:00:00 2001 From: Marisan13 <96127669+Marisan13@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:11:33 +0000 Subject: [PATCH] Lab done --- your-code/main.ipynb | 92 ++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 25 deletions(-) diff --git a/your-code/main.ipynb b/your-code/main.ipynb index b8b7a9c..6e6fceb 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -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", "\"\"\"" ] }, @@ -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)))" ] }, { @@ -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)" ] }, { @@ -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" }, @@ -137,7 +179,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.11.3" } }, "nbformat": 4,