diff --git a/your-code/main.ipynb b/your-code/main.ipynb index b8b7a9c..f72a984 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -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" ] }, { @@ -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" ] }, { @@ -74,9 +74,7 @@ "metadata": {}, "outputs": [], "source": [ - "\"\"\"\n", - "your solution here\n", - "\"\"\"" + "#Picnic = (0.50 * 0.10) / 0.40 = 0.125" ] }, { @@ -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)" ] }, { @@ -123,7 +149,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -137,7 +163,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.10.9" } }, "nbformat": 4,