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
147 changes: 133 additions & 14 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -24,15 +37,19 @@
"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",
"\"\"\""
]
},
{
"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",
Expand All @@ -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",
"\"\"\""
]
},
Expand All @@ -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",
"\"\"\""
]
},
Expand All @@ -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": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Yes</th>\n",
" <th>No</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>men</th>\n",
" <td>0.675</td>\n",
" <td>0.325</td>\n",
" </tr>\n",
" <tr>\n",
" <th>women</th>\n",
" <td>0.675</td>\n",
" <td>0.325</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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"
]
},
{
Expand All @@ -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"
},
Expand All @@ -137,7 +256,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down