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
198 changes: 169 additions & 29 deletions module-2/probability-intro/your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
"P(A U B) = 0.6 is False\n",
" \n",
"Explanation:\n",
" P(A ∪ B) = [P(A)= 0.3] + [P(B) = 0.6] - [P(A ∩ B) = 0.1] = 0.8 \n",
" P(A ∪ B) = 0.8\n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"\n",
"print(\" \")\n",
"print(\"P(A U B) = 0.6 is False\")\n",
"print(\" \")\n",
"print(\"Explanation:\")\n",
"print(\" P(A ∪ B) = [P(A)= 0.3] + [P(B) = 0.6] - [P(A ∩ B) = 0.1] = 0.8 \")\n",
"print(\" P(A ∪ B) = 0.8\")"
]
},
{
Expand All @@ -44,13 +63,52 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Taking a white ball out:\n",
" \n",
" -- P = 10 / (12 + 8 + 10) = 1/3\n",
" \n",
"Taking a white ball out after taking a black ball out:\n",
" \n",
" -- P = 10 / (30 - 1) = 10/29\n",
" \n",
"Taking a red ball out after taking a black and a red ball out:\n",
" \n",
" -- P = (12 - 1) / (30 - 2) = 11/28\n",
" \n",
"Taking a red ball out after taking a black and a red ball out with reposition:\n",
" \n",
" -- P = (12 - 1) / (30 - 2 + 1) = 11/29\n",
" \n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"\n",
"print(\"Taking a white ball out:\")\n",
"print(\" \")\n",
"print(\" -- P = 10 / (12 + 8 + 10) = 1/3\")\n",
"print(\" \")\n",
"print(\"Taking a white ball out after taking a black ball out:\")\n",
"print(\" \")\n",
"print(\" -- P = 10 / (30 - 1) = 10/29\")\n",
"print(\" \")\n",
"print(\"Taking a red ball out after taking a black and a red ball out:\")\n",
"print(\" \")\n",
"print(\" -- P = (12 - 1) / (30 - 2) = 11/28\")\n",
"print(\" \")\n",
"print(\"Taking a red ball out after taking a black and a red ball out with reposition:\")\n",
"print(\" \")\n",
"print(\" -- P = (12 - 1) / (30 - 2 + 1) = 11/29\")\n",
"print(\" \")"
]
},
{
Expand All @@ -70,13 +128,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
"The chance is: \n",
" \n",
" -- P( Rainy / Cloudy ) = 1/8\n",
" \n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"print(\" \")\n",
"print(\"The chance is: \")\n",
"print(\" \")\n",
"print(\" -- P( Rainy / Cloudy ) = 1/8\")\n",
"print(\" \")"
]
},
{
Expand All @@ -102,23 +176,89 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[0.675, 0.325, 0.675, 0.325]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# your code here"
"# your code here\n",
"\n",
"Pm_yes =324/480\n",
"Pm_no =156/480\n",
"\n",
"Pw_yes =351/520\n",
"Pw_no =169/520\n",
"\n",
"lst=[Pm_yes, Pm_no, Pw_yes, Pw_no]\n",
"\n",
"# lst equal proportion"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
"Said No:\n",
" \n",
" -- P( No/ Men ) = 0.325\n",
" -- P( No/ Men ) = 0.325\n",
" -- P(No) = 0.325\n",
" \n",
"Said Yes:\n",
" \n",
" -- P( Yes/ Men ) = 0.675\n",
" -- P( Yes/ Men ) = 0.675\n",
" -- P(Yes) = 0.675\n",
" \n",
"THIS EVENTS ARE INDEPENDENT\n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"\"\"\""
"print(\" \")\n",
"print(\"Said No:\")\n",
"print(\" \")\n",
"print(\" -- P( No/ Men ) = 0.325\")\n",
"print(\" -- P( No/ Men ) = 0.325\")\n",
"print(\" -- P(No) = 0.325\")\n",
"print(\" \")\n",
"print(\"Said Yes:\")\n",
"print(\" \")\n",
"print(\" -- P( Yes/ Men ) = 0.675\")\n",
"print(\" -- P( Yes/ Men ) = 0.675\")\n",
"print(\" -- P(Yes) = 0.675\")\n",
"print(\" \")\n",
"print(\"THIS EVENTS ARE INDEPENDENT\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -137,7 +277,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.5.4"
}
},
"nbformat": 4,
Expand Down