diff --git a/data/part-10/1-class-hierarchies.md b/data/part-10/1-class-hierarchies.md index 552c2c71b..de1605e32 100644 --- a/data/part-10/1-class-hierarchies.md +++ b/data/part-10/1-class-hierarchies.md @@ -307,7 +307,7 @@ class PlatinumCard(BonusCard): return bonus ``` -So, the bonus for a PlatinumCard is calculated by calling the overriden method in the base class, and then adding an extra 5 percent to the base result. An example of how these classes are used: +So, the bonus for a PlatinumCard is calculated by calling the overridden method in the base class, and then adding an extra 5 percent to the base result. An example of how these classes are used: ```python if __name__ == "__main__": diff --git a/data/part-10/4-application-development.md b/data/part-10/4-application-development.md index d718a8468..b323613e5 100644 --- a/data/part-10/4-application-development.md +++ b/data/part-10/4-application-development.md @@ -26,7 +26,7 @@ Objects and classes are by no means necessary in every programming context. For When programs grow in complexity, the amount of details quickly becomes unmanageable, unless the program is organised in some systematic way. Even some of the more complicated exercises on this course so far would have benefited from the examples set in this part of the material. -Fo decades the concept of [separation of concerns](https://en.wikipedia.org/wiki/Separation_of_concerns) has been one of the central principles in programming, and the larger field of computer science. Quoting from Wikipedia: +For decades the concept of [separation of concerns](https://en.wikipedia.org/wiki/Separation_of_concerns) has been one of the central principles in programming, and the larger field of computer science. Quoting from Wikipedia: _Separation of concerns is a design principle for separating a computer program into distinct sections such that each section addresses a separate concern. A concern is a set of information that affects the code of a computer program._ @@ -147,7 +147,7 @@ application = PhoneBookApplication() application.execute() ``` -This program doesn't do very much yet, but let's go through the contents. The constructor method creates a new PhoneBook, which is stored in a private attribute. The method `execute(self)` starts the program's text-based user interface, the core of which is the `while` loop, which keeps asking the user for commands until they type in the command for exiting. There is also a method for intructions, `help(self)`, which is called before entering the loop, so that the instructions are printed out. +This program doesn't do very much yet, but let's go through the contents. The constructor method creates a new PhoneBook, which is stored in a private attribute. The method `execute(self)` starts the program's text-based user interface, the core of which is the `while` loop, which keeps asking the user for commands until they type in the command for exiting. There is also a method for instructions, `help(self)`, which is called before entering the loop, so that the instructions are printed out. Now, let's add some actual functionality. First, we implement adding new data to the phone book: @@ -680,7 +680,7 @@ The file handling process in the PhoneBook application proceeds as follows: the There are many good guidebooks for learning about good programming practices. One such is [Clean Code](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882) by Robert Martin. The code examples in the book are implemented in Java, however, so working through the examples can be quite cumbersome at this point in your programming career, although the book itself is much recommended by the course staff. The themes of easily maintained, expandable, good quality code will be further explored on the courses [Software Development Methods](https://studies.helsinki.fi/courses/cu/hy-CU-118024742-2020-08-01) and [Software Engineering](https://studies.helsinki.fi/courses/cu/hy-CU-118024909-2020-08-01). -Writing code according to established object oriented programming principles comes at a price. You will likely end up writing more code than you would, were you to write your implementation in one continuous bout of spaghetti code. One of the key skills of a porgrammer is to decide the best approach for each situation. Sometimes it is necessary to just hack something together quickly for immediate use. On the other hand, if in the foreseeable future it can be expected that the code will be reused, maintained or futher developed, either by you or, more critically, by someone else entirely, the readability and logical modularity of the program code become essential. More often than not, if it is worth doing, it is worth doing well, even in the very early stages of development. +Writing code according to established object oriented programming principles comes at a price. You will likely end up writing more code than you would, were you to write your implementation in one continuous bout of spaghetti code. One of the key skills of a programmer is to decide the best approach for each situation. Sometimes it is necessary to just hack something together quickly for immediate use. On the other hand, if in the foreseeable future it can be expected that the code will be reused, maintained or further developed, either by you or, more critically, by someone else entirely, the readability and logical modularity of the program code become essential. More often than not, if it is worth doing, it is worth doing well, even in the very early stages of development. To finish off this part of the material you will implement one more larger application. diff --git a/data/part-11/1-list-comprehensions.md b/data/part-11/1-list-comprehensions.md index fa3662fb2..81d807c0c 100644 --- a/data/part-11/1-list-comprehensions.md +++ b/data/part-11/1-list-comprehensions.md @@ -38,7 +38,7 @@ numbers = [1, 2, 3, 6, 5, 4, 7] strings = [str(number) for number in numbers] ``` -The second line above contains many of the same elements as the more traditional iterative apporach, but the syntax is different. One way of generalising a list comprehension statement would be +The second line above contains many of the same elements as the more traditional iterative approach, but the syntax is different. One way of generalising a list comprehension statement would be `[ for in ]` @@ -107,7 +107,7 @@ if __name__ == "__main__": print(factorials) ``` -List comprehensions allow us to express the same functionality more consisely, usually without losing any of the readability. +List comprehensions allow us to express the same functionality more concisely, usually without losing any of the readability. We can also return a list comprehension statement from a function directly. If we needed a function for producing factorials for lists of numbers, we could achieve it very concisely: diff --git a/data/part-11/2-more-comprehensions.md b/data/part-11/2-more-comprehensions.md index e6e512fd1..e7a360e27 100644 --- a/data/part-11/2-more-comprehensions.md +++ b/data/part-11/2-more-comprehensions.md @@ -443,7 +443,7 @@ When the function is called with the arguments `most_common_words("comprehension -NB: the case of letters affects the results, and all inflected forms are unique words in this exercise. That is, the words `List`, `lists` and `list` are each separate words here, and only `list` has enough occurrences to make it to the returned list. All punctutation should be removed before counting up the occurrences. +NB: the case of letters affects the results, and all inflected forms are unique words in this exercise. That is, the words `List`, `lists` and `list` are each separate words here, and only `list` has enough occurrences to make it to the returned list. All punctuation should be removed before counting up the occurrences. It is up to you to decide how to implement this. The easiest way would likely be to make use of list and dictionary comprehensions. diff --git a/data/part-11/3-recursion.md b/data/part-11/3-recursion.md index 4f829fe19..e51f3d099 100644 --- a/data/part-11/3-recursion.md +++ b/data/part-11/3-recursion.md @@ -146,7 +146,7 @@ The factorial of 6 is 720 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)`. -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. +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. The [visualisation tool](http://www.pythontutor.com/visualize.html#mode=edit) can be a great help in making sense of recursive programs. diff --git a/data/part-11/4-more-recursion-examples.md b/data/part-11/4-more-recursion-examples.md index 8a24741af..2c73d1ce9 100644 --- a/data/part-11/4-more-recursion-examples.md +++ b/data/part-11/4-more-recursion-examples.md @@ -459,7 +459,7 @@ The first exercise point is granted for a working application when all user inpu ## Handling errors in user input -To gain the second exercise point for this exercise your application is expected to recover from erroneus user input. Any input which does not follow the specified format should produce an error message _erroneous input_, and result in yet another repeat of the loop asking for a new command: +To gain the second exercise point for this exercise your application is expected to recover from erroneous user input. Any input which does not follow the specified format should produce an error message _erroneous input_, and result in yet another repeat of the loop asking for a new command: diff --git a/data/part-12/2-generators.md b/data/part-12/2-generators.md index f4bec00e6..efca2e028 100644 --- a/data/part-12/2-generators.md +++ b/data/part-12/2-generators.md @@ -249,7 +249,7 @@ jkl Please write a function named `word_generator(characters: str, length: int, amount: int)` which returns a new generator for generating random words based on the parameters given. -A random word is generated by selecting from the string named `characters` as many characters as is indicated by the argument `length`. The same character can appear many times in a random word. +A random word is generated by selecting from the string named `characters` as many characters as indicated by the argument `length`. The same character can appear many times in a random word. The generator returns as many words as specified by the argument `amount` before terminating. diff --git a/data/part-12/3-functional-programming.md b/data/part-12/3-functional-programming.md index 50483c066..da90b817e 100644 --- a/data/part-12/3-functional-programming.md +++ b/data/part-12/3-functional-programming.md @@ -23,7 +23,7 @@ As mentioned above, functional programming is a programming paradigm, or a style * procedural programming, where the program is grouped into procedures or sub-programs * object-oriented programming, where the program and its state is stored in objects defined in classes. -There are differing opinions on the divisions between the different paradigms; for example, some maintain that imperative and procedural programming mean the same thing, while others place imperative programming as an umbrella term which covers both procedural and object-oriented programming. Th terminology and divisions are not that important, and neither is strictly sticking to one or the other paradigm, but it is important to understand that such different approaches exist, as they affect the choices programmers make. +There are differing opinions on the divisions between the different paradigms; for example, some maintain that imperative and procedural programming mean the same thing, while others place imperative programming as an umbrella term which covers both procedural and object-oriented programming. The terminology and divisions are not that important, and neither is strictly sticking to one or the other paradigm, but it is important to understand that such different approaches exist, as they affect the choices programmers make. Many programming languages are designed with one or the other programming paradigm in mind, but Python is a rather versatile programming language, and allows for following several different programming paradigms, even within a single program. This lets us choose the most efficient and clear method for solving each problem. @@ -650,7 +650,7 @@ If the initial value is left out, `reduce` takes the first item in the list as t -**NB:** if the items in the series are of a different type than the intended reduced result, the thrd argument is mandatory. The example with the bank accounts would not work without the initial value. That is, trying this +**NB:** if the items in the series are of a different type than the intended reduced result, the third argument is mandatory. The example with the bank accounts would not work without the initial value. That is, trying this ```python balances_total = reduce(balance_sum_helper, accounts) diff --git a/data/part-13/3-events.md b/data/part-13/3-events.md index cc4cbfada..5aeddb5c4 100644 --- a/data/part-13/3-events.md +++ b/data/part-13/3-events.md @@ -51,7 +51,7 @@ Let's assume the program was left running for a while, and then the exit button ``` -The first few events concern mouse usage, ten there are some events from the keyboard, and finally the last event closes the program. Each event has at least a type, but they may also offer some other identifying info, such as the location of the mouse cursor or the key that was pressed. +The first few events concern mouse usage, then there are some events from the keyboard, and finally the last event closes the program. Each event has at least a type, but they may also offer some other identifying info, such as the location of the mouse cursor or the key that was pressed. You can look for event descriptions in the [pygame documentation](https://www.pygame.org/docs/ref/event.html), but it can sometimes be easier to print out events with the code above, and look for the event that occurs when something you want to react to happens. diff --git a/data/part-13/4-more-pygame-techniques.md b/data/part-13/4-more-pygame-techniques.md index dfce3e50c..2d9b61a3b 100644 --- a/data/part-13/4-more-pygame-techniques.md +++ b/data/part-13/4-more-pygame-techniques.md @@ -75,7 +75,7 @@ Running the above code should look like this: -Here the method `pygame.font.SysFont` creates a font object, which uses the system font Arial in size 24. The the method `render` creates an image of the specified text in the given colour. This image is drawn on the window with the `blit` method, just as before. +Here the method `pygame.font.SysFont` creates a font object, which uses the system font Arial in size 24. Then the method `render` creates an image of the specified text in the given colour. This image is drawn on the window with the `blit` method, just as before. NB: different systems will have different fonts available. If the system this program is exeuted on doesn't have the Arial font, even though Arial is a very common font available on most systems, the default system font is used instead. If you need to have a specific font available for your game, you can include the font file in the game directory and specify its location for the `pygame.font.Font` method. diff --git a/data/part-4/4-definite-iteration.md b/data/part-4/4-definite-iteration.md index 89347dd44..6016700bb 100644 --- a/data/part-4/4-definite-iteration.md +++ b/data/part-4/4-definite-iteration.md @@ -176,7 +176,7 @@ for i in range(1, 9, 2): -A step can also be negative. Then the range will be in reversed orded. Notice the first two arguments are also flipped here: +A step can also be negative. Then the range will be in reversed order. Notice the first two arguments are also flipped here: ```python for i in range(6, 2, -1): diff --git a/data/part-5/1-more-lists.md b/data/part-5/1-more-lists.md index 2eca3bf50..d9503d000 100644 --- a/data/part-5/1-more-lists.md +++ b/data/part-5/1-more-lists.md @@ -300,7 +300,7 @@ Alan: age 39 years, height 1.78 meters 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`. -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. +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. ## Matrices @@ -333,7 +333,7 @@ print(my_matrix) -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: +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: ```python my_matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] diff --git a/data/part-5/3-dictionary.md b/data/part-5/3-dictionary.md index 33752d847..37837447e 100644 --- a/data/part-5/3-dictionary.md +++ b/data/part-5/3-dictionary.md @@ -411,7 +411,7 @@ quitting... ## Removing keys and values from a dictionary -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`: +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`: ```python staff = {"Alan": "lecturer", "Emily": "professor", "David": "lecturer"} diff --git a/data/part-5/4-tuple.md b/data/part-5/4-tuple.md index 45b4f60a2..69f032f2c 100644 --- a/data/part-5/4-tuple.md +++ b/data/part-5/4-tuple.md @@ -189,7 +189,7 @@ numbers = (1, 2, 3) numbers = 1, 2, 3 ``` -This means we can also easily return multiple values using tuples. Let's have alook at he following example: +This means we can also easily return multiple values using tuples. Let's have a look at he following example: ```python def minmax(my_list): diff --git a/data/part-6/1-reading-files.md b/data/part-6/1-reading-files.md index 6269fa25a..ba26dfdc1 100644 --- a/data/part-6/1-reading-files.md +++ b/data/part-6/1-reading-files.md @@ -296,7 +296,7 @@ Traceback (most recent call last): UnboundLocalError: local variable 'oldest' referenced before assignment ``` -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. +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. If we want to access the contents in the second `for` loop, we will have to `open` the file a second time: @@ -426,7 +426,7 @@ with open("people.csv") as new_file: print(last_names) ``` -Exectuing this would print out +Executing this would print out @@ -662,7 +662,7 @@ liisa virtanen 3 -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. +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. The final grade for the course is determined based on the sum of exam and exercise points according to the following table: diff --git a/data/part-6/2-writing-files.md b/data/part-6/2-writing-files.md index 4d21ca4f3..b55fa796f 100644 --- a/data/part-6/2-writing-files.md +++ b/data/part-6/2-writing-files.md @@ -107,7 +107,7 @@ Hi Ada, we hope you enjoy learning Python with us! Best, Mooc.fi Team 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`. -If the file doesn't yet exist, append mode works exatly like write mode. +If the file doesn't yet exist, append mode works exactly like write mode. The following program opens the file `new_file.txt` and appends a couple of lines of text to the end: @@ -421,7 +421,7 @@ Emily;41;5 -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. +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. 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: @@ -449,7 +449,7 @@ If we determine a certain functionality in the program needs fixing, in a well d Let's revisit the course grading project from the previous section. -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: +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: diff --git a/data/part-6/3-errors.md b/data/part-6/3-errors.md index 4b361f2d9..f3f4b1b31 100644 --- a/data/part-6/3-errors.md +++ b/data/part-6/3-errors.md @@ -15,7 +15,7 @@ After this section -The are two basic categories of errors that come up in programming contexts: +There are two basic categories of errors that come up in programming contexts: 1. Syntax errors, which prevent the execution of the program 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 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. -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. +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. Let's change the above example so that the program is prepared for the `ValueError` exception: @@ -99,7 +99,7 @@ This is not a valid age 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. -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. +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. 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. @@ -333,7 +333,7 @@ Invalid parameters in this case include: -The file `lottery_numbers.csv` containts winning lottery numbers in the following format: +The file `lottery_numbers.csv` contains winning lottery numbers in the following format: diff --git a/data/part-7/4-data-processing.md b/data/part-7/4-data-processing.md index e0eedb5e1..a8c279a91 100644 --- a/data/part-7/4-data-processing.md +++ b/data/part-7/4-data-processing.md @@ -16,7 +16,7 @@ After this section ## Reading CSV files -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: +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: ```python import csv @@ -308,7 +308,7 @@ timo;18:42 kalle;13:23 ``` -Additionally, the file `submissions.csv` contains points and handin times for individual exercises. The format here is `name;task;points;hh:mm`. An example: +Additionally, the file `submissions.csv` contains points and handing times for individual exercises. The format here is `name;task;points;hh:mm`. An example: ```csv jarmo;1;8;16:05 @@ -332,7 +332,7 @@ You have the CSV files from the previous exercise at your disposal again. Please The tasks are numbered 1 to 8, and each submission is graded with 0 to 6 points. -In the dicionary returned the key should be the name of the student, and the value the total points received by the student. +In the dictionary returned the key should be the name of the student, and the value the total points received by the student. Hint: nested dictionaries might be a good approach when processing the tasks and submission times of each student. diff --git a/data/part-7/6-more-features.md b/data/part-7/6-more-features.md index 776888e7d..b177eb724 100644 --- a/data/part-7/6-more-features.md +++ b/data/part-7/6-more-features.md @@ -171,7 +171,7 @@ Please write a function named `run(program)`, which takes a list containing the 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. -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. +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. Below are some examples, which you may also use for testing. Example 1: diff --git a/data/part-8/1-objects-and-methods.md b/data/part-8/1-objects-and-methods.md index f2b8e3889..467355bb7 100644 --- a/data/part-8/1-objects-and-methods.md +++ b/data/part-8/1-objects-and-methods.md @@ -14,7 +14,7 @@ After this section -This is the first part of the Advanced Course in Programming. The material is designed to be used with the Visual Studio Code editor, just like the preceding Introduction to Programming course was. If you haven't use Visual Studio Code before, you will find the installation instructions [here](https://www.mooc.fi/en/installation/vscode), and an introduction to the programming environment from the previous course [here](/part-4/1-vscode). +This is the first part of the Advanced Course in Programming. The material is designed to be used with the Visual Studio Code editor, just like the preceding Introduction to Programming course was. If you haven't used Visual Studio Code before, you will find the installation instructions [here](https://www.mooc.fi/en/installation/vscode), and an introduction to the programming environment from the previous course [here](/part-4/1-vscode). In the Introduction to Programming course we noticed that it often makes sense to group related data together in our programs. For example, if we are trying to store information about a book, it might make sense to use a tuple or a dictionary to organize the data into a single data structure. diff --git a/data/part-8/3-defining-classes.md b/data/part-8/3-defining-classes.md index 2e8836310..181a1edc5 100644 --- a/data/part-8/3-defining-classes.md +++ b/data/part-8/3-defining-classes.md @@ -120,7 +120,7 @@ assigns the balance received as an argument to the balance attribute of the obje * The variable `self.balance` is an attribute of the object. Each `BankAccount` object has its own balance. -* The variable `balance` is a parameter in the constructor method `__init__`. Its value is set to the value passed as an argument to the method as the constructor is called (that is, when a new insctance of the class is created). +* The variable `balance` is a parameter in the constructor method `__init__`. Its value is set to the value passed as an argument to the method as the constructor is called (that is, when a new instance of the class is created). Now that we have defined the parameters of the constructor method, we can pass the desired initial values of the data attributes as arguments as a new object is created: @@ -266,7 +266,7 @@ Please also include a constructor in each class. The constructor should take the -## Using objecs formed from your own classes +## Using objects formed from your own classes Objects formed from your own class definitions are no different from any other Python objects. They can be passed as arguments and return values just like any other object. We could, for example, write some helper functions for working with bank accounts: diff --git a/data/part-8/5-more-examples-of-classes.md b/data/part-8/5-more-examples-of-classes.md index 2b45a9bc6..ea73a31c6 100644 --- a/data/part-8/5-more-examples-of-classes.md +++ b/data/part-8/5-more-examples-of-classes.md @@ -43,7 +43,7 @@ A new `Rectangle` is created with two tuples as arguments. These tuples contain The methods `area` and `perimeter` calculate the area and perimeter of the rectangle based on the height and width. The method `move` moves the rectangle by the x and y values given as arguments. -The rectanlge is represented in a coordinate system where the x coordinates increase from left to right, and the y coordinates increase from top to bottom. This is a common way of handling coordinates in programming because it is often easier and more natural to consider the top left corner of the computer screen as the point where x and y equal zero. +The rectangle is represented in a coordinate system where the x coordinates increase from left to right, and the y coordinates increase from top to bottom. This is a common way of handling coordinates in programming because it is often easier and more natural to consider the top left corner of the computer screen as the point where x and y equal zero. The following program tests the `Rectangle` class: diff --git a/data/part-9/1-objects-and-references.md b/data/part-9/1-objects-and-references.md index bacdddbfd..284591fdb 100644 --- a/data/part-9/1-objects-and-references.md +++ b/data/part-9/1-objects-and-references.md @@ -923,7 +923,7 @@ To the left of the dot is the object itself, which is referred to as `self` with The printout from the program is exactly the same as with the function implementation above. -A rather cosmetic point to finish off: the `if...else` structure in the method `older_than` is by and large unneccessary. The value of the Boolean expression in the condition is already the exact same truth value which is returned. The method can thus be simplified: +A rather cosmetic point to finish off: the `if...else` structure in the method `older_than` is by and large unnecessary. The value of the Boolean expression in the condition is already the exact same truth value which is returned. The method can thus be simplified: ```python class Person: diff --git a/data/part-9/2-objects-as-attributes.md b/data/part-9/2-objects-as-attributes.md index cd37a77fa..d0d87654c 100644 --- a/data/part-9/2-objects-as-attributes.md +++ b/data/part-9/2-objects-as-attributes.md @@ -387,7 +387,7 @@ Dorothy (155 cm) ## The shortest person -Please define the method `shortest()` within the `Room` class definition. The method should return the shortest person in the room it is called on. If the room is empty, the method should return `None`. The method should _not_ remove the person fron the room. +Please define the method `shortest()` within the `Room` class definition. The method should return the shortest person in the room it is called on. If the room is empty, the method should return `None`. The method should _not_ remove the person from the room. ```python room = Room() diff --git a/data/part-9/3-encapsulation.md b/data/part-9/3-encapsulation.md index b39b9a036..fe173241e 100644 --- a/data/part-9/3-encapsulation.md +++ b/data/part-9/3-encapsulation.md @@ -289,7 +289,7 @@ ValueError: The amount must not be below zero -**NB:** the getter method, i.e. the `@property` decorator, must be introduced before the setter method, or there will be an error when the class is executed. This is because the `@property` decorator defines the name of the "attribute" offerred to the client. The setter method, added with `.setter`, simply adds a new functionality to it. +**NB:** the getter method, i.e. the `@property` decorator, must be introduced before the setter method, or there will be an error when the class is executed. This is because the `@property` decorator defines the name of the "attribute" offered to the client. The setter method, added with `.setter`, simply adds a new functionality to it. diff --git a/data/part-9/6-more-examples-with-classes.md b/data/part-9/6-more-examples-with-classes.md index 88ec32e70..b250c0475 100644 --- a/data/part-9/6-more-examples-with-classes.md +++ b/data/part-9/6-more-examples-with-classes.md @@ -330,7 +330,7 @@ book.weight = 10 Please write a class named `Suitcase`. You should be able to pack items into a suitcase. A suitcase also has a maximum combined weight for the items stored within. -Your class should contains the following members: +Your class should contain the following members: - a constructor which takes the maximum weight as an argument - a method named `add_item` which adds the item given as an argument to the suitcase. The method has no return value.