diff --git a/your-code/main.ipynb b/your-code/main.ipynb index b8b7a9c..4050046 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -10,11 +10,24 @@ "A and B are events of a probability space with $(\\omega, \\sigma, P)$ such that $P(A) = 0.3$, $P(B) = 0.6$ and $P(A \\cap B) = 0.1$\n", "\n", "Which of the following statements are false?\n", - "* $P(A \\cup B) = 0.6$\n", - "* $P(A \\cap B^{C}) = 0.2$\n", - "* $P(A \\cap (B \\cup B^{C})) = 0.4$\n", - "* $P(A^{C} \\cap B^{C}) = 0.3$\n", - "* $P((A \\cap B)^{C}) = 0.9$" + "* 1. $P(A \\cup B) = 0.6$\n", + "* 2. $P(A \\cap B^{C}) = 0.2$\n", + "* 3. $P(A \\cap (B \\cup B^{C})) = 0.4$\n", + "* 4. $P(A^{C} \\cap B^{C}) = 0.3$\n", + "* 5. $P((A \\cap B)^{C}) = 0.9$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# P(A) = 0.3\n", + "# P(B) = 0.6\n", + "\n", + "# P(A and B) = 0.1\n", + "\n" ] }, { @@ -24,7 +37,11 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "1. Wrong (0.8)\n", + "2. correct\n", + "3. Wrong (0.3)\n", + "4. Wrong (0.2)\n", + "5. Correct\n", "\"\"\"" ] }, @@ -32,7 +49,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Challenge 2\n", + "# Challenge 2\n", "There is a box with 10 white balls, 12 red balls and 8 black balls. Calculate the probability of:\n", "* Taking a white ball out.\n", "* Taking a white ball out after taking a black ball out.\n", @@ -49,7 +66,17 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "w = 10\n", + "r = 12\n", + "b = 8\n", + "\n", + "total = 30\n", + "\n", + "Task:\n", + "1. 8/30\n", + "2. 8/29\n", + "3. 11/28\n", + "4. 12/30\n", "\"\"\"" ] }, @@ -75,7 +102,16 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "P(C|R) = 0.5\n", + "P(C) = 0.4\n", + "P(R) = 0.3\n", + "\n", + "\n", + "\n", + "P(R|C) = P(C and R) / P(C)\n", + "P(R|C) = 0.4*0.3 / 0.4\n", + "P(R|C) = 0.12 / 0.4\n", + "P(R|C) = 0.3\n", "\"\"\"" ] }, @@ -102,11 +138,94 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "total = 1000\n", + "\n", + "m = 480\n", + "nm = 520\n", + "\n", + "m_y = 324\n", + "nm_y = 351\n", + "\n", + "m_n = 156\n", + "nm_y = 169\n", + "\n", + "y = m_y + nm_y\n", + "n = m_n + nm_y" + ] + }, + { + "cell_type": "code", + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
YesNo
men0.6750.325
women0.6750.325
\n", + "
" + ], + "text/plain": [ + " Yes No\n", + "men 0.675 0.325\n", + "women 0.675 0.325" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mydict = {\"Yes\": [324/480, 351/520], \"No\" : [156/480, 169/520] }\n", + "mylist = [\"men\", \"women\"]\n", + "pd.DataFrame(mydict, index = mylist)\n" ] }, { @@ -116,14 +235,14 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "the output is not affected by the gender that means that they are not dependent\n", "\"\"\"" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -137,7 +256,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.11.4" } }, "nbformat": 4,