Skip to content

Commit 7e02828

Browse files
committed
fixing question numbers
1 parent 7b90498 commit 7e02828

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

assignments/answers/assignment3_answers.ipynb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"source": [
1616
"#### Answer to A. Python basics, strings, printing (Shaw Exercises 1–10)\n",
1717
"\n",
18-
"1. Take the file of Python code you generated in Exercise 1, called `ex1.py`, and run it on the command line. Copy the command and output from your terminal and paste it in a markdown cell in your Jupyter notebook. (Ex1)"
18+
"Q1. Take the file of Python code you generated in Exercise 1, called `ex1.py`, and run it on the command line. Copy the command and output from your terminal and paste it in a markdown cell in your Jupyter notebook. (Ex1)"
1919
]
2020
},
2121
{
@@ -75,7 +75,7 @@
7575
"cell_type": "markdown",
7676
"metadata": {},
7777
"source": [
78-
"2. Print a sentence that contains a phrase in double quotes; print a sentence that contains an apostrophe. (Ex1)"
78+
"Q2. Print a sentence that contains a phrase in double quotes; print a sentence that contains an apostrophe. (Ex1)"
7979
]
8080
},
8181
{
@@ -110,7 +110,7 @@
110110
"cell_type": "markdown",
111111
"metadata": {},
112112
"source": [
113-
"3. Deliberately enter five incorrect commands (in separate cells) and interpret the error messages. (Ex1)"
113+
"Q3. Deliberately enter five incorrect commands (in separate cells) and interpret the error messages. (Ex1)"
114114
]
115115
},
116116
{
@@ -261,7 +261,7 @@
261261
"cell_type": "markdown",
262262
"metadata": {},
263263
"source": [
264-
"4. Add comments to your code in \\#2 and \\#3 explaining what is happening. (Ex2)"
264+
"Q4. Add comments to your code in \\#2 and \\#3 explaining what is happening. (Ex2)"
265265
]
266266
},
267267
{
@@ -275,7 +275,7 @@
275275
"cell_type": "markdown",
276276
"metadata": {},
277277
"source": [
278-
"5. Write and evaluate five mathematical expressions. (Ex3)"
278+
"Q5. Write and evaluate five mathematical expressions. (Ex3)"
279279
]
280280
},
281281
{
@@ -444,7 +444,7 @@
444444
"cell_type": "markdown",
445445
"metadata": {},
446446
"source": [
447-
"6. Assign values to three numeric and three string variables. (Ex4)"
447+
"Q6. Assign values to three numeric and three string variables. (Ex4)"
448448
]
449449
},
450450
{
@@ -472,7 +472,7 @@
472472
"cell_type": "markdown",
473473
"metadata": {},
474474
"source": [
475-
"7. Print values of the six variables you assigned in \\#6. (Ex4–5)"
475+
"Q7. Print values of the six variables you assigned in \\#6. (Ex4–5)"
476476
]
477477
},
478478
{
@@ -505,7 +505,7 @@
505505
"cell_type": "markdown",
506506
"metadata": {},
507507
"source": [
508-
"8. Print two strings in raw format (%r formatter) and two strings in general/string format (%s formatter) with formatting characters. (Ch6)"
508+
"Q8. Print two strings in raw format (%r formatter) and two strings in general/string format (%s formatter) with formatting characters. (Ch6)"
509509
]
510510
},
511511
{
@@ -538,7 +538,7 @@
538538
"cell_type": "markdown",
539539
"metadata": {},
540540
"source": [
541-
"9. Concatenate two strings into a third string, then find the length of all three strings."
541+
"Q9. Concatenate two strings into a third string, then find the length of all three strings."
542542
]
543543
},
544544
{
@@ -575,7 +575,7 @@
575575
"cell_type": "markdown",
576576
"metadata": {},
577577
"source": [
578-
"10. Print the three strings from \\#9 with a tab between the first and second and a newline between the second and third.\n"
578+
"Q10. Print the three strings from \\#9 with a tab between the first and second and a newline between the second and third."
579579
]
580580
},
581581
{
@@ -607,7 +607,7 @@
607607
"cell_type": "markdown",
608608
"metadata": {},
609609
"source": [
610-
"11. Print the three strings from \\#9 with a stored formatter. (Ch7–8)"
610+
"Q11. Print the three strings from \\#9 with a stored formatter. (Ch7–8)"
611611
]
612612
},
613613
{
@@ -640,7 +640,7 @@
640640
"cell_type": "markdown",
641641
"metadata": {},
642642
"source": [
643-
"12. Print a piece of text with five lines using both newline characters and a text block. (Ex9)"
643+
"Q12. Print a piece of text with five lines using both newline characters and a text block. (Ex9)"
644644
]
645645
},
646646
{
@@ -705,7 +705,7 @@
705705
"cell_type": "markdown",
706706
"metadata": {},
707707
"source": [
708-
"13. Print a string containing a backslash, single-quote, double-qoute, newline, and tab. (Ex10)"
708+
"Q13. Print a string containing a backslash, single-quote, double-qoute, newline, and tab. (Ex10)"
709709
]
710710
},
711711
{
@@ -739,11 +739,11 @@
739739
"source": [
740740
"#### Answer to B. Taking input, reading and writing files, functions (Shaw Exercises 11-26) \n",
741741
"\n",
742-
"1. Write some code, without using functions, that calculates the average of 5 numbers. Do it three different ways:\n",
742+
"Q1. Write some code, without using functions, that calculates the average of 5 numbers. Do it three different ways:\n",
743743
"\n",
744-
" - Write a .py file that takes input from the command line using `input()`. After the script works, paste the text of the file into your Jupyter notebook.\n",
745-
" - Write a .py file that takes input from the command line using `argv`. After the script works, paste the text of the file into your Jupyter notebook.\n",
746-
" - Enter code into two Jupyter notebooks cells: the first stores value as variables, and the second computes the average."
744+
"- Write a .py file that takes input from the command line using `input()`. After the script works, paste the text of the file into your Jupyter notebook.\n",
745+
"- Write a .py file that takes input from the command line using `argv`. After the script works, paste the text of the file into your Jupyter notebook.\n",
746+
"- Enter code into two Jupyter notebooks cells: the first stores value as variables, and the second computes the average."
747747
]
748748
},
749749
{
@@ -852,10 +852,10 @@
852852
"cell_type": "markdown",
853853
"metadata": {},
854854
"source": [
855-
"2. Using functions, write some code that takes two strings, prints them with the first letter capitalized, prints them with all letters capitalized, prints the first and last letter of each, prints the length of each, and then prints the concatenation of the two strings. Do it two different ways:\n",
855+
"Q2. Using functions, write some code that takes two strings, prints them with the first letter capitalized, prints them with all letters capitalized, prints the first and last letter of each, prints the length of each, and then prints the concatenation of the two strings. Do it two different ways:\n",
856856
"\n",
857-
" - Write a .py file that uses `argv`. After the script works, paste the text of the file into your Jupyter notebook.\n",
858-
" - In your Jupyter notebook, comment out the `argv` portions and hard code in the values of your strings. Then make sure the code runs the same."
857+
"- Write a .py file that uses `argv`. After the script works, paste the text of the file into your Jupyter notebook.\n",
858+
"- In your Jupyter notebook, comment out the `argv` portions and hard code in the values of your strings. Then make sure the code runs the same."
859859
]
860860
},
861861
{
@@ -931,13 +931,13 @@
931931
"cell_type": "markdown",
932932
"metadata": {},
933933
"source": [
934-
"3. Using a text editor, create a comma-separated values (CSV) file with 5 columns and 5 rows. Save it in the same directory as your Jupyter notebook. In the Jupyter notebook, read and print the file in different ways, and write new files, as follows:\n",
934+
"Q3. Using a text editor, create a comma-separated values (CSV) file with 5 columns and 5 rows. Save it in the same directory as your Jupyter notebook. In the Jupyter notebook, read and print the file in different ways, and write new files, as follows:\n",
935935
"\n",
936-
" - Read your CSV file using `read()`, `readline()`, or `readlines()`, and print the output to the screen (`print()` command is optional in notebooks!).\n",
937-
" - Do the same but use a `with` block and a different one of `read()`, `readline()`, or `readlines()`.\n",
938-
" - Using either of the two above methods, then change one row of data, and write your data to a new CSV file.\n",
939-
" - Read your CSV file using Pandas and display the resulting DataFrame.\n",
940-
" - Save your DataFrame to a new file using Pandas."
936+
"- Read your CSV file using `read()`, `readline()`, or `readlines()`, and print the output to the screen (`print()` command is optional in notebooks!).\n",
937+
"- Do the same but use a `with` block and a different one of `read()`, `readline()`, or `readlines()`.\n",
938+
"- Using either of the two above methods, then change one row of data, and write your data to a new CSV file.\n",
939+
"- Read your CSV file using Pandas and display the resulting DataFrame.\n",
940+
"- Save your DataFrame to a new file using Pandas."
941941
]
942942
},
943943
{
@@ -1185,7 +1185,7 @@
11851185
"name": "python",
11861186
"nbconvert_exporter": "python",
11871187
"pygments_lexer": "ipython3",
1188-
"version": "3.7.0"
1188+
"version": "3.7.1"
11891189
}
11901190
},
11911191
"nbformat": 4,

assignments/answers/assignment6_answers.ipynb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"cell_type": "markdown",
5252
"metadata": {},
5353
"source": [
54-
"1. Import the tab-separated values file `emp_qiime_mapping_subset_2k.tsv` as a DataFrame called `df` with default data types, with the first row as column labels (columns) and the first column as row labels (indexes)."
54+
"Q1. Import the tab-separated values file `emp_qiime_mapping_subset_2k.tsv` as a DataFrame called `df` with default data types, with the first row as column labels (columns) and the first column as row labels (indexes)."
5555
]
5656
},
5757
{
@@ -67,7 +67,7 @@
6767
"cell_type": "markdown",
6868
"metadata": {},
6969
"source": [
70-
"2. The indexes should be the sample IDs. How many samples are in this DataFrame? How many metadata columns?"
70+
"Q2. The indexes should be the sample IDs. How many samples are in this DataFrame? How many metadata columns?"
7171
]
7272
},
7373
{
@@ -96,7 +96,7 @@
9696
"cell_type": "markdown",
9797
"metadata": {},
9898
"source": [
99-
"3. What are the minimum and maximum pH values in the dataset?"
99+
"Q3. What are the minimum and maximum pH values in the dataset?"
100100
]
101101
},
102102
{
@@ -123,7 +123,7 @@
123123
"cell_type": "markdown",
124124
"metadata": {},
125125
"source": [
126-
"4. What are the average and standard deviation temperature values in the dataset?"
126+
"Q4. What are the average and standard deviation temperature values in the dataset?"
127127
]
128128
},
129129
{
@@ -480,7 +480,7 @@
480480
"cell_type": "markdown",
481481
"metadata": {},
482482
"source": [
483-
"1. Make a new Series called `temp` with the temperature column as its own Series object. Remove NaN values (`np.nan`) from this Series. How many values are left?"
483+
"Q1. Make a new Series called `temp` with the temperature column as its own Series object. Remove NaN values (`np.nan`) from this Series. How many values are left?"
484484
]
485485
},
486486
{
@@ -539,7 +539,7 @@
539539
"cell_type": "markdown",
540540
"metadata": {},
541541
"source": [
542-
"2. Make a new DataFrame called `df_seqs` from columns `sequences_split_libraries` through `observations_deblur_150bp` (column positions 17-23) of the existing DataFrame. What is the mean value of `column observations_deblur_90bp`?"
542+
"Q2. Make a new DataFrame called `df_seqs` from columns `sequences_split_libraries` through `observations_deblur_150bp` (column positions 17-23) of the existing DataFrame. What is the mean value of `column observations_deblur_90bp`?"
543543
]
544544
},
545545
{
@@ -913,7 +913,7 @@
913913
"cell_type": "markdown",
914914
"metadata": {},
915915
"source": [
916-
"3. Save `df_seqs` as a csv file."
916+
"Q3. Save `df_seqs` as a csv file."
917917
]
918918
},
919919
{
@@ -946,7 +946,7 @@
946946
"cell_type": "markdown",
947947
"metadata": {},
948948
"source": [
949-
"1. Store the first 5 rows of `df_seqs` as a new dataframe called `df_seqs_head`. Store the last 5 rows of `df_seqs` as a new dataframe called `df_seqs_tail`."
949+
"Q1. Store the first 5 rows of `df_seqs` as a new dataframe called `df_seqs_head`. Store the last 5 rows of `df_seqs` as a new dataframe called `df_seqs_tail`."
950950
]
951951
},
952952
{
@@ -973,7 +973,7 @@
973973
"cell_type": "markdown",
974974
"metadata": {},
975975
"source": [
976-
"2. Concatenate `df_seqs_head` and `df_seqs_tail` using the `concat()` function."
976+
"Q2. Concatenate `df_seqs_head` and `df_seqs_tail` using the `concat()` function."
977977
]
978978
},
979979
{
@@ -1232,7 +1232,7 @@
12321232
"cell_type": "markdown",
12331233
"metadata": {},
12341234
"source": [
1235-
"3. Append `df_seqs_tail` to `df_seqs_head` using the `append()` function."
1235+
"Q3. Append `df_seqs_tail` to `df_seqs_head` using the `append()` function."
12361236
]
12371237
},
12381238
{
@@ -1491,7 +1491,7 @@
14911491
"cell_type": "markdown",
14921492
"metadata": {},
14931493
"source": [
1494-
"4. Make a new DataFrame called `df_phys` with the pH, temperature, and salinity columns (hint: you will need to know the exact column names; these are some of the last few columns). Make another new DataFrame called `df_empo` with the column `empo_3` (note: this will actually be a Series because it has only one column, but you can treat it like a DataFrame)."
1494+
"Q4. Make a new DataFrame called `df_phys` with the pH, temperature, and salinity columns (hint: you will need to know the exact column names; these are some of the last few columns). Make another new DataFrame called `df_empo` with the column `empo_3` (note: this will actually be a Series because it has only one column, but you can treat it like a DataFrame)."
14951495
]
14961496
},
14971497
{
@@ -1516,7 +1516,7 @@
15161516
"cell_type": "markdown",
15171517
"metadata": {},
15181518
"source": [
1519-
"5. Merge `df_phys` with `df_seqs` using the `merge()` function with the indexes of both DataFrames to make a new DataFrame called `df_merged`."
1519+
"Q5. Merge `df_phys` with `df_seqs` using the `merge()` function with the indexes of both DataFrames to make a new DataFrame called `df_merged`."
15201520
]
15211521
},
15221522
{
@@ -1712,7 +1712,7 @@
17121712
"cell_type": "markdown",
17131713
"metadata": {},
17141714
"source": [
1715-
"6. Join `df_merged` with `df_empo` using the `join()` function and store the result as `df_merged`."
1715+
"Q6. Join `df_merged` with `df_empo` using the `join()` function and store the result as `df_merged`."
17161716
]
17171717
},
17181718
{
@@ -1922,7 +1922,7 @@
19221922
"cell_type": "markdown",
19231923
"metadata": {},
19241924
"source": [
1925-
"1. Use a list comprehension to add a new column to `df_merged` called `temperature_deg_f` which takes the values in `temperature_deg_c` and converts them to degrees Fahrenheit."
1925+
"Q1. Use a list comprehension to add a new column to `df_merged` called `temperature_deg_f` which takes the values in `temperature_deg_c` and converts them to degrees Fahrenheit."
19261926
]
19271927
},
19281928
{
@@ -1938,7 +1938,7 @@
19381938
"cell_type": "markdown",
19391939
"metadata": {},
19401940
"source": [
1941-
"2. Create a function that changes a single numerical value from Celsius to Fahrenheit. Apply this function to the values in `temperature_deg_c` using `apply()` to create a new column called `temperature_deg_f_2`."
1941+
"Q2. Create a function that changes a single numerical value from Celsius to Fahrenheit. Apply this function to the values in `temperature_deg_c` using `apply()` to create a new column called `temperature_deg_f_2`."
19421942
]
19431943
},
19441944
{
@@ -2146,7 +2146,7 @@
21462146
"cell_type": "markdown",
21472147
"metadata": {},
21482148
"source": [
2149-
"1. Sort the rows in `df_merged` by `sequences_split_libraries` values from high to low and store the result as `df_merged`. (Hint: you can use `inplace=True`.)"
2149+
"Q1. Sort the rows in `df_merged` by `sequences_split_libraries` values from high to low and store the result as `df_merged`. (Hint: you can use `inplace=True`.)"
21502150
]
21512151
},
21522152
{
@@ -2371,7 +2371,7 @@
23712371
"cell_type": "markdown",
23722372
"metadata": {},
23732373
"source": [
2374-
"2. Sort the columns in `df_merged` by column name from A to Z and store the result as `df_merged`. (Hint: you can use `inplace=True`.)"
2374+
"Q2. Sort the columns in `df_merged` by column name from A to Z and store the result as `df_merged`. (Hint: you can use `inplace=True`.)"
23752375
]
23762376
},
23772377
{
@@ -2600,7 +2600,7 @@
26002600
"name": "python",
26012601
"nbconvert_exporter": "python",
26022602
"pygments_lexer": "ipython3",
2603-
"version": "3.7.0"
2603+
"version": "3.7.1"
26042604
}
26052605
},
26062606
"nbformat": 4,

0 commit comments

Comments
 (0)