Skip to content

Commit f59b696

Browse files
author
giumas
committed
fixed minor bugs in 006 and 007 after Jason
1 parent d8f4943 commit f59b696

2 files changed

+9
-7
lines changed

006_Read_and_Write_Text_Files.ipynb

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"cell_type": "markdown",
2020
"metadata": {},
2121
"source": [
22-
"You have learned about lists and how to write your own functions with loops and conditional statements. This allows you to write programs performing a variety of tasks. \n",
22+
"You have learned about lists and how to [write your own functions](005_Write_Your_Own_Functions.ipynb) with [loops](004_Loops.ipynb) and [conditional statements](003_Conditional_Execution.ipynb). This allows you to write programs performing a variety of tasks. \n",
2323
"\n",
2424
"However, a convenient mechanism to access data that you want to analyze is currently missing. In this notebook, we will explore the use of [files](https://en.wikipedia.org/wiki/Computer_file) since they are a common way to access stored data."
2525
]
@@ -78,7 +78,7 @@
7878
"source": [
7979
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/key.png\">\n",
8080
"\n",
81-
"In Python, a **module** is a file containing definitions and statements. "
81+
"In Python, a **module** is a file containing code (e.g., definitions and statements). "
8282
]
8383
},
8484
{
@@ -183,7 +183,7 @@
183183
"cell_type": "markdown",
184184
"metadata": {},
185185
"source": [
186-
"To be able to access the `data` sub-folder, we extend the previous code using `os.path.join()` and `os.path.exist()` functions to:\n",
186+
"To be able to access the `data` sub-folder, we extend the previous code using `os.path.join()` and `os.path.exists()` functions to:\n",
187187
"\n",
188188
"- Create the absolute path to the `data` sub-folder.\n",
189189
"- Check whether the resulting path actually exists."
@@ -242,7 +242,7 @@
242242
"cell_type": "markdown",
243243
"metadata": {},
244244
"source": [
245-
"We will now retrieve all the paths to the files in the `data` folder. Specifically, we will create a function `get_data_paths()` that returns a list containing all the files in that folder, using the `os.listdir()` function."
245+
"We will now retrieve all the paths to the files in the `data` folder. Specifically, we will create a function `get_data_paths()` that returns a list containing all the files in that folder, using the `os.listdir()` function from the `os` module."
246246
]
247247
},
248248
{
@@ -251,6 +251,8 @@
251251
"metadata": {},
252252
"outputs": [],
253253
"source": [
254+
"import os\n",
255+
"\n",
254256
"def get_data_paths():\n",
255257
" data_paths = list() # create an empty list to be populated and returned\n",
256258
" data_folder = get_data_folder() # call the function you created to return the data directory path\n",
@@ -289,7 +291,7 @@
289291
"source": [
290292
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/key.png\">\n",
291293
"\n",
292-
"You do not need to remember all the names of the available Python functions, but you need to learn how to search for them. The [official Python documentation](https://docs.python.org/3.6/index.html) is a good place to start. You can also get a list of the functions in the `os.path` module by entering `dir('os.path')` in a code cell."
294+
"You do not need to remember all the names of the available Python functions, but you need to learn how to search for them. The [official Python documentation](https://docs.python.org/3.6/index.html) is a good place to start. You can also get a list of the functions in the `os.path` module by entering `dir(os.path)` in a code cell."
293295
]
294296
},
295297
{
@@ -428,7 +430,7 @@
428430
"cell_type": "markdown",
429431
"metadata": {},
430432
"source": [
431-
"You may ask why there are 100 characters instead of 80? Each of the 20 rows has 4 visible characters (e.g., `30.8`), but there is also the invisible [newline character](https://en.wikipedia.org/wiki/Newline) (i.e., `\\n`) that text editors treat as a new line. Thus, `(4+1) * 20 = 100` characters."
433+
"You may ask why there are 100 characters instead of 80? Each of the 20 rows has 4 visible characters (e.g., `30.8`), but there is also the invisible [newline character](https://en.wikipedia.org/wiki/Newline) (i.e., `\\n`) that text editors treat as a break between two lines. Thus, `(4+1) * 20 = 100` characters."
432434
]
433435
},
434436
{

007_Dictionaries_and_Metadata.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"\n",
7474
"- All the item pairs are printed between curly brackets (i.e., `{`, `}`). \n",
7575
"- The items are separated by a comma (e.g., the pair `\"Li\": \"Lithium\"` is an item). \n",
76-
"- For each item, the two parts are separated by a `-`: the key on the left (e.g., `\"Li\"`) and the value on the right (e.g., `\"Lithium\"`).\n"
76+
"- For each item, the two parts are separated by a `:` with the key (e.g., `\"Li\"`) on the left and the value (e.g., `\"Lithium\"`) on the right."
7777
]
7878
},
7979
{

0 commit comments

Comments
 (0)