GeezerVison is showing github.com — fix typos and grammar · python043/full-speed-python@126414c
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: chapters/dictionaries.tex +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ \chapter{Dictionaries}\label{dictionaries} | 34 | 34 | Gabriel 10 | 35 | 35 | \end{lstlisting} | 36 | 36 |
| 37 | | -However, dictionary keys don't need to be necessarily strings but can be any \href{https://docs.python.org/3/tutorial/datastructures.html#dictionaries}{immutable} object: | | 37 | +However, dictionary keys don't necessarily need to be strings but can be any \href{https://docs.python.org/3/tutorial/datastructures.html#dictionaries}{immutable} object: | 38 | 38 |
| 39 | 39 | \begin{lstlisting} | 40 | 40 | d = { | @@ -87,7 +87,7 @@ \section{Exercises with dictionaries} | 87 | 87 |
| 88 | 88 | \item How many students are in the dictionary? Search for the "len" function. | 89 | 89 |
| 90 | | -\item Implement a function that receives the "ages" dictionary as parameter and return the average age of the students. Traverse all items on the dictionary using the "items" method as above. | | 90 | +\item Implement a function that receives the "ages" dictionary as parameter and returns the average age of the students. Traverse all items on the dictionary using the "items" method as above. | 91 | 91 |
| 92 | 92 | \item Implement a function that receives the "ages" dictionary as parameter and returns the name of the oldest student. | 93 | 93 |
| @@ -113,6 +113,6 @@ \section{Exercises with sub-dictionaries} | 113 | 113 |
| 114 | 114 | \item Implement a function that receives the students dict and returns the average age. | 115 | 115 |
| 116 | | -\item Implement a function that receives the students dict and an address, and returns a list with the name of all students which address matches the address in the argument. For instance, invoking "find\_students(students, 'Lisbon')" should return Peter and Anna. | | 116 | +\item Implement a function that receives the students dict and an address, and returns a list with names of all students whose address matches the address in the argument. For instance, invoking "find\_students(students, 'Lisbon')" should return Peter and Anna. | 117 | 117 |
| 118 | 118 | \end{enumerate} |
Collapse file Copy file name to clipboardExpand all lines: chapters/loops.tex +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -97,11 +97,11 @@ \section{Exercises with the for loop} | 97 | 97 |
| 98 | 98 | \item Create a function that receives a list as parameter and returns the maximum value in the list. As you iterate over the list you may want to keep the maximum value found so far in order to keep comparing it with the next elements of the list. | 99 | 99 |
| 100 | | -\item Modify the previous function such that it returns a list with the first element being the maximum value and the second being the index of the maximum value in the list. Besides keep the last maximum value found so far, you need to keep also the position where it occured. | | 100 | +\item Modify the previous function such that it returns a list with the first element being the maximum value and the second being the index of the maximum value in the list. Besides keeping the maximum value found so far, you also need to keep the position where it occurred. | 101 | 101 |
| 102 | 102 | \item Implement a function that returns the reverse of a list received as parameter. You may create an empty list and keep adding the values in reversed order as they come from the original list. Check what you can do with lists at \url{https://docs.python.org/3/tutorial/datastructures.html#more-on-lists}. | 103 | 103 |
| 104 | | -\item Make the function "is\_sorted" that receives a list as parameter and returns True if the list is sorted by increasing order. For instance [1, 2, 2, 3] is ordered while [1, 2, 3, 2] is not. Suggestion: you have to compare a number in the list with the next one, so you can use indexes or you need to keep the previous number in a variable as you iterate over the list. | | 104 | +\item Make the function "is\_sorted" that receives a list as parameter and returns True if the list is sorted in ascending order. For instance [1, 2, 2, 3] is ordered while [1, 2, 3, 2] is not. Suggestion: you have to compare a number in the list with the next one, so you can use indexes or you need to keep the previous number in a variable as you iterate over the list. | 105 | 105 |
| 106 | 106 | \item Implement the function "is\_sorted\_dec" which is similar to the previous one but all items must be sorted by decreasing order. | 107 | 107 |
| |
|