Skip to content

Commit e8e5846

Browse files
Fix miscellaneous typos and spelling mistakes
1 parent f221fd6 commit e8e5846

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

data/part-11/3-recursion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ The factorial of 6 is 720
146146

147147
If the parameter of the recursive factorial function is 0 or 1, the function returns 1, because this is how the factorial operation is defined. In any other case the function returns the value `n * factorial(n - 1)`, which is the value of its parameter `n` multiplied by the return value of the function call `factorial(n - 1)`.
148148

149-
The crucial part here is that the function definition contains a stop condition. If this is met, the recursion ends. In this case that condition is `n < 2`. We know it will be reached eventually, beacuse the value passed as the argument to the function is decreased by one on each level of the recursion.
149+
The crucial part here is that the function definition contains a stop condition. If this is met, the recursion ends. In this case that condition is `n < 2`. We know it will be reached eventually, because the value passed as the argument to the function is decreased by one on each level of the recursion.
150150

151151
The [visualisation tool](http://www.pythontutor.com/visualize.html#mode=edit) can be a great help in making sense of recursive programs.
152152

data/part-4/4-definite-iteration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ for i in range(1, 9, 2):
176176

177177
</sample-output>
178178

179-
A step can also be negative. Then the range will be in reversed orded. Notice the first two arguments are also flipped here:
179+
A step can also be negative. Then the range will be in reversed order. Notice the first two arguments are also flipped here:
180180

181181
```python
182182
for i in range(6, 2, -1):

data/part-5/1-more-lists.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ Alan: age 39 years, height 1.78 meters
300300

301301
The `for` loop goes through the items in the outer list one by one. That is, each list containing information about a single person is, in turn, assigned to the variable `person`.
302302

303-
Lists arent always the best way to present data, such as information about a person. We will soon come across Python _dictionaries_, which are often better suited to such situations.
303+
Lists aren't always the best way to present data, such as information about a person. We will soon come across Python _dictionaries_, which are often better suited to such situations.
304304

305305
## Matrices
306306

@@ -333,7 +333,7 @@ print(my_matrix)
333333

334334
</sample-output>
335335

336-
Like any other list, the rows of the matrix can be traversed wth a `for` loop. The following code prints out each row of the matrix on a separate line:
336+
Like any other list, the rows of the matrix can be traversed with a `for` loop. The following code prints out each row of the matrix on a separate line:
337337

338338
```python
339339
my_matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

data/part-5/3-dictionary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ quitting...
411411

412412
## Removing keys and values from a dictionary
413413

414-
It is naturally possible to also remove key-value paris from the dictionary. There are two ways to accomplish this. The first is the command `del`:
414+
It is naturally possible to also remove key-value pairs from the dictionary. There are two ways to accomplish this. The first is the command `del`:
415415

416416
```python
417417
staff = {"Alan": "lecturer", "Emily": "professor", "David": "lecturer"}

data/part-5/4-tuple.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ numbers = (1, 2, 3)
189189
numbers = 1, 2, 3
190190
```
191191

192-
This means we can also easily return multiple values using tuples. Let's have alook at he following example:
192+
This means we can also easily return multiple values using tuples. Let's have a look at he following example:
193193

194194
```python
195195
def minmax(my_list):

data/part-6/1-reading-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Traceback (most recent call last):
296296
UnboundLocalError: local variable 'oldest' referenced before assignment
297297
```
298298

299-
The reason this happens is that the latter `for` loop is not executed at all, beacuse the file can only be processed once. Once the last line is read, the file handle rests at the end of the file, and the data in the file can no longer be accessed.
299+
The reason this happens is that the latter `for` loop is not executed at all, because the file can only be processed once. Once the last line is read, the file handle rests at the end of the file, and the data in the file can no longer be accessed.
300300

301301
If we want to access the contents in the second `for` loop, we will have to `open` the file a second time:
302302

@@ -426,7 +426,7 @@ with open("people.csv") as new_file:
426426
print(last_names)
427427
```
428428

429-
Exectuing this would print out
429+
Executing this would print out
430430

431431
<sample-output>
432432

@@ -662,7 +662,7 @@ liisa virtanen 3
662662

663663
</sample-output>
664664

665-
Each completed exercise is counted towards _exercise points_, so that completing at least 10 % of the total exercices awards 1 point, completing at least 20 % awards 2 points, etc. Completing all 40 exercises awards 10 points. The number of points awarded is always an integer number.
665+
Each completed exercise is counted towards _exercise points_, so that completing at least 10 % of the total exercises awards 1 point, completing at least 20 % awards 2 points, etc. Completing all 40 exercises awards 10 points. The number of points awarded is always an integer number.
666666

667667
The final grade for the course is determined based on the sum of exam and exercise points according to the following table:
668668

data/part-6/2-writing-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Hi Ada, we hope you enjoy learning Python with us! Best, Mooc.fi Team
107107

108108
If you want to append data to the end of a file, instead of overwriting the entire file, you should open the file in append mode with the argument `a`.
109109

110-
If the file doesn't yet exist, append mode works exatly like write mode.
110+
If the file doesn't yet exist, append mode works exactly like write mode.
111111

112112
The following program opens the file `new_file.txt` and appends a couple of lines of text to the end:
113113

@@ -421,7 +421,7 @@ Emily;41;5
421421

422422
</sample-data>
423423

424-
Notice how each function defined above is relatively simple, and they all have a single responsibility. This is a common and advisable approach when programming larger wholes. The single reponsibility principle makes verifying functionality easier. It also makes it easier to make changes to the program later, and to add new features.
424+
Notice how each function defined above is relatively simple, and they all have a single responsibility. This is a common and advisable approach when programming larger wholes. The single responsibility principle makes verifying functionality easier. It also makes it easier to make changes to the program later, and to add new features.
425425

426426
Say we wanted to add a function for printing out the grade for a single student. We already have a function which determines the student's grade, so we can use this in our new function:
427427

@@ -449,7 +449,7 @@ If we determine a certain functionality in the program needs fixing, in a well d
449449

450450
Let's revisit the course grading project from the previous section.
451451

452-
As we left if last time, the program read and processed files containing student information, completed exercises and exam results. We'll add a file containing information about the course. An example of the format of the file:
452+
As we left it last time, the program read and processed files containing student information, completed exercises and exam results. We'll add a file containing information about the course. An example of the format of the file:
453453

454454
<sample-data>
455455

data/part-6/3-errors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ After this section
1515

1616
</text-box>
1717

18-
The are two basic categories of errors that come up in programming contexts:
18+
There are two basic categories of errors that come up in programming contexts:
1919

2020
1. Syntax errors, which prevent the execution of the program
2121
2. Runtime errors, which halt the execution
@@ -74,7 +74,7 @@ The `int` function is unable to parse the input string `twenty-three` as a valid
7474

7575
Errors that occur while the program is already running are called _exceptions_. It is possible to prepare for exceptions, and handle them so that the execution continues despite them occurring.
7676

77-
Exception handling in Python is accomplished with `try` and `except` statements. The idea is that if something within a `try` block causes an exception, Python checks if there is a corresponding `except` block. If such a block exists, it is executed and the program themn continues as if nothing happened.
77+
Exception handling in Python is accomplished with `try` and `except` statements. The idea is that if something within a `try` block causes an exception, Python checks if there is a corresponding `except` block. If such a block exists, it is executed and the program then continues as if nothing happened.
7878

7979
Let's change the above example so that the program is prepared for the `ValueError` exception:
8080

@@ -99,7 +99,7 @@ This is not a valid age
9999

100100
We can use the `try` block to flag that the code within the block may cause an error. In the `except` statement directly after the block the relevant error is mentioned. In the above example we covered only a `ValueError` exception. If the exception had some other cause, the execution would still have halted, despite the `try` and `except` blocks.
101101

102-
In the above example, if the error is caught, the value of `age` is set to -1. This is an invalid input value which we have already programmed behaviour for, as the program excpects the age of the user to be greater than 0.
102+
In the above example, if the error is caught, the value of `age` is set to -1. This is an invalid input value which we have already programmed behaviour for, as the program expects the age of the user to be greater than 0.
103103

104104
In the following example we have a function `read_integer`, which asks the user to type in an integer value, but the function is also prepared for invalid input. The function keeps asking for integers until the user types in a valid input value.
105105

@@ -333,7 +333,7 @@ Invalid parameters in this case include:
333333

334334
<programming-exercise name='Incorrect lottery numbers' tmcname='part06-19_incorrect_lottery_numbers'>
335335

336-
The file `lottery_numbers.csv` containts winning lottery numbers in the following format:
336+
The file `lottery_numbers.csv` contains winning lottery numbers in the following format:
337337

338338
<sample-data>
339339

data/part-7/4-data-processing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ After this section
1616

1717
## Reading CSV files
1818

19-
CSV is such a simple format that so far we have accessed the with hand-written code. There is, however, a ready-made module in the Python standard library for working with CSV files: [csv](https://docs.python.org/3/library/csv.html). It works like this:
19+
CSV is such a simple format that so far we have accessed with the hand-written code. There is, however, a ready-made module in the Python standard library for working with CSV files: [csv](https://docs.python.org/3/library/csv.html). It works like this:
2020

2121
```python
2222
import csv
@@ -308,7 +308,7 @@ timo;18:42
308308
kalle;13:23
309309
```
310310
311-
Additionally, the file `submissions.csv` contains points and handin times for individual exercises. The format here is `name;task;points;hh:mm`. An example:
311+
Additionally, the file `submissions.csv` contains points and handing times for individual exercises. The format here is `name;task;points;hh:mm`. An example:
312312
313313
```csv
314314
jarmo;1;8;16:05
@@ -332,7 +332,7 @@ You have the CSV files from the previous exercise at your disposal again. Please
332332
333333
The tasks are numbered 1 to 8, and each submission is graded with 0 to 6 points.
334334
335-
In the dicionary returned the key should be the name of the student, and the value the total points received by the student.
335+
In the dictionary returned the key should be the name of the student, and the value the total points received by the student.
336336
337337
Hint: nested dictionaries might be a good approach when processing the tasks and submission times of each student.
338338

data/part-7/6-more-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Please write a function named `run(program)`, which takes a list containing the
171171

172172
You may assume the function will only be given programs which are entirely in the correct format. You do not have to implement any input validation or error handling.
173173

174-
This exercise is worth two points. You will receive one point if the commands `PRINT`, `MOV`, `ADD`, `SUB`, `MUL` and `END` are working correctly. You will receice another point if the rest of the commands, which are used to implement loops, also work.
174+
This exercise is worth two points. You will receive one point if the commands `PRINT`, `MOV`, `ADD`, `SUB`, `MUL` and `END` are working correctly. You will receive another point if the rest of the commands, which are used to implement loops, also work.
175175

176176
Below are some examples, which you may also use for testing. Example 1:
177177

0 commit comments

Comments
 (0)