diff --git a/your-code/main.ipynb b/your-code/main.ipynb index b8b7a9c..aa480fd 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -24,7 +24,12 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "Statement 1 --> False\n", + "Statement 2 --> True\n", + "Statement 3 --> False\n", + "Statement 4 --> False\n", + "Statement 5 --> True\n", + "\n", "\"\"\"" ] }, @@ -49,7 +54,10 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "#1 = 0.333\n", + "#2 = 0.344\n", + "#3 = 0.39\n", + "#4 = 0.4\n", "\"\"\"" ] }, @@ -75,7 +83,11 @@ "outputs": [], "source": [ "\"\"\"\n", - "your solution here\n", + "P C|R 0.5\n", + "P C = 0.4\n", + "P R = 0.1\n", + "\n", + "P R|C = 0.125\n", "\"\"\"" ] }, @@ -102,28 +114,134 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
GenderValue
Answer
YesMen324
YesWomen351
NoMen156
NoWoman169
\n", + "
" + ], + "text/plain": [ + " Gender Value\n", + "Answer \n", + "Yes Men 324\n", + "Yes Women 351\n", + "No Men 156\n", + "No Woman 169" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "import pandas as pd\n", + "\n", + "df = pd.DataFrame({\"Gender\":[\"Men\", \"Women\", \"Men\", \"Woman\"], \"Answer\":[\"Yes\",\"Yes\",\"No\", \"No\"], \"Value\":[324, 351, 156, 169]}).set_index(\"Answer\")\n", + "df" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.675\n", + "0.324\n" + ] + } + ], "source": [ - "\"\"\"\n", - "your solution here\n", + "yes = (df.iloc[0][1]+df.iloc[1][1])\n", + "p1 = yes / sum(df[\"Value\"])\n", + "men_if_yes = df.iloc[0][1]/yes\n", + "p2 = p1 * men_if_yes\n", + "print(p1)\n", + "print(p2)" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "' \\nThe fact of one wanting more light does not depend on whter one is male or female.\\n'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\"\"\" \n", + "The fact of one wanting more light does not depend on whter one is male or female.\n", "\"\"\"" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -137,7 +255,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.11.3" } }, "nbformat": 4,