You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/01-python/python-control-flow.ipynb
+25-3Lines changed: 25 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -471,9 +471,9 @@
471
471
"name": "stdout",
472
472
"output_type": "stream",
473
473
"text": [
474
-
"key = key2, value = 2\n",
474
+
"key = key1, value = 1\n",
475
475
"key = key3, value = 3\n",
476
-
"key = key1, value = 1\n"
476
+
"key = key2, value = 2\n"
477
477
]
478
478
}
479
479
],
@@ -593,6 +593,28 @@
593
593
"cell_type": "markdown",
594
594
"metadata": {},
595
595
"source": [
596
+
"## Q 1\n",
597
+
"\n",
598
+
"We can use the `input()` function to ask for input from the prompt (note: in python 2 the function was called `raw_input()`).\n",
599
+
"\n",
600
+
"Create an empty list and use a while loop to ask the user for input and append their input to the list. Keep looping until 10 items are added to the list"
601
+
]
602
+
},
603
+
{
604
+
"cell_type": "code",
605
+
"execution_count": null,
606
+
"metadata": {
607
+
"collapsed": true
608
+
},
609
+
"outputs": [],
610
+
"source": []
611
+
},
612
+
{
613
+
"cell_type": "markdown",
614
+
"metadata": {},
615
+
"source": [
616
+
"## Q 2\n",
617
+
"\n",
596
618
"Here's some text (the Gettysburg Address). Our goal is to count how many times each word repeats. We'll do a brute force method first, and then we'll look a ways to do it more efficiently (and compactly)."
597
619
]
598
620
},
@@ -1045,7 +1067,7 @@
1045
1067
"cell_type": "markdown",
1046
1068
"metadata": {},
1047
1069
"source": [
1048
-
"## 1\n",
1070
+
"## your task\n",
1049
1071
"\n",
1050
1072
"Create a dictionary that uses the unique words as keys and has as a value the number of times that word appears. \n",
0 commit comments