Spellchecking in ref floder. Hopefully for the only time. (#3816)

This commit is contained in:
BethanyG
2024-11-06 14:35:18 -08:00
committed by GitHub
parent dcc052c730
commit 27931ea05d
25 changed files with 40 additions and 40 deletions

View File

@@ -3,4 +3,4 @@
TODO: ADD MORE TODO: ADD MORE
- this solution uses Boolean values (`True` / `False`) [hamming](../exercise-concepts/hamming.md) - this solution uses Boolean values (`True` / `False`) [hamming](../exercise-concepts/hamming.md)
- True and False of type `bopl`. The example solution uses `True` and `False` as return values from functions that test membership in a list of values. [markdown](../exercise-concepts/markdown.md) - True and False of type `bool`. The example solution uses `True` and `False` as return values from functions that test membership in a list of values. [markdown](../exercise-concepts/markdown.md)

View File

@@ -1,6 +1,6 @@
# `dict` # `dict`
Python's primary [mapping type][docs-mapping-type] that associatess keys with values in a [hash map][hash-map]. Python's primary [mapping type][docs-mapping-type] that associates keys with values in a [hash map][hash-map].
See examples of usage in [markdown][markdown], [rna-transcription][rna-transcription], and [robot-simulator][robot-simulator]. See examples of usage in [markdown][markdown], [rna-transcription][rna-transcription], and [robot-simulator][robot-simulator].

View File

@@ -2,7 +2,7 @@
TODO: ADD MORE DETAIL TODO: ADD MORE DETAIL
See the Python documentation entries for the [`set`][docs-set] collection, the [immutable][set type][docs-set-type]; essentially a [hash map][hash-map] in which only the key is relevant, and which disallows [mutaion][mutation] of keys after intialization. See the Python documentation entries for the [`set`][docs-set] collection, the [immutable][set type][docs-set-type]; essentially a [hash map][hash-map] in which only the key is relevant, and which disallows [mutation][mutation] of keys after initialization.
[immutable]: https://github.com/exercism/v3/blob/main/reference/concepts/immutability.md [immutable]: https://github.com/exercism/v3/blob/main/reference/concepts/immutability.md
[mutation]: https://github.com/exercism/v3/blob/main/reference/concepts/mutation.md [mutation]: https://github.com/exercism/v3/blob/main/reference/concepts/mutation.md

View File

@@ -8,7 +8,7 @@ A multi-dimensional list-with-a-list is used as a simple (but not very efficient
TODO: ADD MORE DETAIL TODO: ADD MORE DETAIL
See the Python documentation entries for the [mutable][mutation] [`list` type][docs-list-type] and it's [constructor][list-as-function]. This is Python's most commonly used [sequential collection][docs-sequence-types], and as it allows _heterogenous data_ it's quite different from the [fixed array][general-concept-array] and [singly-linked list][general-concept-list] types you may have encountered in other, less flexible, languages. See the Python documentation entries for the [mutable][mutation] [`list` type][docs-list-type] and it's [constructor][list-as-function]. This is Python's most commonly used [sequential collection][docs-sequence-types], and as it allows _heterogeneous data_ it's quite different from the [fixed array][general-concept-array] and [singly-linked list][general-concept-list] types you may have encountered in other, less flexible, languages.
[variable-length-quantity]: ../../exercise-concepts/variable-length-quantity.md [variable-length-quantity]: ../../exercise-concepts/variable-length-quantity.md
[markdown]: ../../exercise-concepts/markdown.md [markdown]: ../../exercise-concepts/markdown.md

View File

@@ -3,4 +3,4 @@
TODO: ADD MORE TODO: ADD MORE
- student needs to know how to build an object using its constructor [binary-search-tree](../exercise-concepts/binary-search-tree.md) - student needs to know how to build an object using its constructor [binary-search-tree](../exercise-concepts/binary-search-tree.md)
- customizing object initalization with actions and persisting data. The example uses a constructor to process the passed in data into a list of lists assigned to an instance property [matrix](../exercise-concepts/matrix.md) - customizing object initialization with actions and persisting data. The example uses a constructor to process the passed in data into a list of lists assigned to an instance property [matrix](../exercise-concepts/matrix.md)

View File

@@ -2,4 +2,4 @@
TODO: ADD MORE TODO: ADD MORE
- pre-setting function arguments to protect against them not being passed by a caller. The example uses `direction = NORTH` and `x=0, y=0` to ensure those values for a `robot` even if they are not initally passed. [robot-simulator](../exercise-concepts/robot-simulator.md) - pre-setting function arguments to protect against them not being passed by a caller. The example uses `direction = NORTH` and `x=0, y=0` to ensure those values for a `robot` even if they are not initially passed. [robot-simulator](../exercise-concepts/robot-simulator.md)

View File

@@ -7,4 +7,4 @@ TODO: ADD MORE
- "dunder" -> "double under", referring to the names of these methods being prefixed with two underscores, e.g. `__init__`. There is no formal privacy in Python, but conventionally a single underscore indicates a private method, or one that the programmer should assume may change at any time; methods without an underscore are considered part of an object's public API. Double underscores are even more special - they are used by Python's builtin functions like `len()`, for example, to allow objects to implement various interfaces and functionality. They can also be used for operator overloading. If you have a custom class that you would like to be able to compare to other instances of the same class, implementing `__lt__`, `__gt__`, `__eq__` etc. allow programmers to use the `>`, `<`, `=` operators. Dunder methods allow programmers to build useful objects with simple interfaces, i.e. you can add two instances together using `+` instead of writing something like `instance1.add(instance2)`. [hamming](../exercise-concepts/hamming.md) - "dunder" -> "double under", referring to the names of these methods being prefixed with two underscores, e.g. `__init__`. There is no formal privacy in Python, but conventionally a single underscore indicates a private method, or one that the programmer should assume may change at any time; methods without an underscore are considered part of an object's public API. Double underscores are even more special - they are used by Python's builtin functions like `len()`, for example, to allow objects to implement various interfaces and functionality. They can also be used for operator overloading. If you have a custom class that you would like to be able to compare to other instances of the same class, implementing `__lt__`, `__gt__`, `__eq__` etc. allow programmers to use the `>`, `<`, `=` operators. Dunder methods allow programmers to build useful objects with simple interfaces, i.e. you can add two instances together using `+` instead of writing something like `instance1.add(instance2)`. [hamming](../exercise-concepts/hamming.md)
- the example uses the `__init__` magic method as its constructor for the class [matrix](../exercise-concepts/matrix.md) - the example uses the `__init__` magic method as its constructor for the class [matrix](../exercise-concepts/matrix.md)
- User defined classes can (and generally do) overload the `__init__` method, whose first argument is `self`, because the result of `__init__` is a class _instance_. [phone-number](../exercise-concepts/phone-number.md) - User defined classes can (and generally do) overload the `__init__` method, whose first argument is `self`, because the result of `__init__` is a class _instance_. [phone-number](../exercise-concepts/phone-number.md)
- The example uses `__init__` as a constructor for the class, which also calls `__new__`. In addition, the example uses `__call__()` via the appending of `()` to instance method names, and `__eq__()` (_rich compairison_) via the use of `==` [robot-simulator](../exercise-concepts/robot-simulator.md) - The example uses `__init__` as a constructor for the class, which also calls `__new__`. In addition, the example uses `__call__()` via the appending of `()` to instance method names, and `__eq__()` (_rich_comparison_) via the use of `==` [robot-simulator](../exercise-concepts/robot-simulator.md)

View File

@@ -2,4 +2,4 @@
TODO: ADD MORE TODO: ADD MORE
- customizing object instatiation with actions and persisting data. The example uses `__init__` to persist a `compass` object and x, y coordinates assigned to instance attributes. [robot-simulator](../exercise-concepts/robot-simulator.md) - customizing object instantiation with actions and persisting data. The example uses `__init__` to persist a `compass` object and x, y coordinates assigned to instance attributes. [robot-simulator](../exercise-concepts/robot-simulator.md)

View File

@@ -2,4 +2,4 @@
TODO: ADD MORE TODO: ADD MORE
- this exercise rquires one or more instance attributes to persist passed in data. [robot-simulator](../exercise-concepts/robot-simulator.md) - this exercise requires one or more instance attributes to persist passed in data. [robot-simulator](../exercise-concepts/robot-simulator.md)

View File

@@ -4,6 +4,6 @@ TODO: ADD MORE
- the exercise relies on the `def` statement to create an instance method [allergies](../exercise-concepts/allergies.md) - the exercise relies on the `def` statement to create an instance method [allergies](../exercise-concepts/allergies.md)
- use of `def` to define a class's methods [clock](../exercise-concepts/clock.md) - use of `def` to define a class's methods [clock](../exercise-concepts/clock.md)
- classes can have instance _methods_ which are called from an instance of the class (as opposed to class methods, called from the Class itself). The first parameter of an instance method is always `self`, which is provided when calling from the instance (i.e. the programmer does not need to pass it as an argument explicitly). Static methods are methods called from the class itself, and are not connected to an instance of the class. They have access to class attributes (those defined on the class, not connected to the `self`), and do not require an instance of the class to exist. Classes can also define a `property` by using the `@property` decorator (not shown here); a `property` can be "lazily evaluated" to avoid uneeded computation [phone-number](../exercise-concepts/phone-number.md) - classes can have instance _methods_ which are called from an instance of the class (as opposed to class methods, called from the Class itself). The first parameter of an instance method is always `self`, which is provided when calling from the instance (i.e. the programmer does not need to pass it as an argument explicitly). Static methods are methods called from the class itself, and are not connected to an instance of the class. They have access to class attributes (those defined on the class, not connected to the `self`), and do not require an instance of the class to exist. Classes can also define a `property` by using the `@property` decorator (not shown here); a `property` can be "lazily evaluated" to avoid unneeded computation [phone-number](../exercise-concepts/phone-number.md)
- tests for this exercises require one or more instance methods that will return a specified row or column list of the `matrix`. [matrix](../exercise-concepts/matrix.md) - tests for this exercises require one or more instance methods that will return a specified row or column list of the `matrix`. [matrix](../exercise-concepts/matrix.md)
- tests for this exercises require one or more instance methods that will take in a set of starting coordinates and a bearing and then accept a series of instructions that "move" the instance to a new set of coordinates and bearing. [robot-simulator](../exercise-concepts/robot-simulator.md) - tests for this exercises require one or more instance methods that will take in a set of starting coordinates and a bearing and then accept a series of instructions that "move" the instance to a new set of coordinates and bearing. [robot-simulator](../exercise-concepts/robot-simulator.md)

View File

@@ -2,4 +2,4 @@
TODO: ADD MORE TODO: ADD MORE
- this exercise rquires one or more instance properties to persist passed in data. [matrix](../exercise-concepts/matrix.md) - this exercise requires one or more instance properties to persist passed in data. [matrix](../exercise-concepts/matrix.md)

View File

@@ -4,7 +4,7 @@ TODO: ADD MORE
- the `re.sub()` function of the `re` module that replaces a `regular expression` match with a new value. The example solutions use this function in various places to substitute _markdown_ syntax for _HTML_ syntax in the passed in markdown text. [markdown](../exercise-concepts/markdown.md) - the `re.sub()` function of the `re` module that replaces a `regular expression` match with a new value. The example solutions use this function in various places to substitute _markdown_ syntax for _HTML_ syntax in the passed in markdown text. [markdown](../exercise-concepts/markdown.md)
- Both the original code to be refactored for this exercise and the example solution import and use the `re` module for Regular Expressions in python. [markdown](../exercise-concepts/markdown.md) - Both the original code to be refactored for this exercise and the example solution import and use the `re` module for Regular Expressions in python. [markdown](../exercise-concepts/markdown.md)
- the `re.match()` function from the `re` module returns a `match` object with any matched values from a specified Regular Expression or pre-compliled Regular Expression. The example uses `re.match()` in multiple places to search for text patterns that need re-formatting or subsitituting. [markdown](../exercise-concepts/markdown.md) - the `re.match()` function from the `re` module returns a `match` object with any matched values from a specified Regular Expression or pre-compiled Regular Expression. The example uses `re.match()` in multiple places to search for text patterns that need re-formatting or substituting. [markdown](../exercise-concepts/markdown.md)
- Various functions in the re module return a `re.Match` _instance_ which in turn has a `Match.group` method. `Match.group` exists even if there are no groups specified in the pattern. See the [Match.group docs](https://docs.python.org/3/library/re.html#re.Match.group) for more detail. [markdown](../exercise-concepts/markdown.md) - Various functions in the re module return a `re.Match` _instance_ which in turn has a `Match.group` method. `Match.group` exists even if there are no groups specified in the pattern. See the [Match.group docs](https://docs.python.org/3/library/re.html#re.Match.group) for more detail. [markdown](../exercise-concepts/markdown.md)
- regular expressions is a language of sorts that can detect substrings and extract groups from a string, as well as replace them with something else [phone-number](../exercise-concepts/phone-number.md) - regular expressions is a language of sorts that can detect substrings and extract groups from a string, as well as replace them with something else [phone-number](../exercise-concepts/phone-number.md)
- A Domain Specific Language (DSL) for text processing. Like many other programming languages in use, python supports a quasi-dialect of PCRE (_Perl compatible regular expressions_). `Regular expressions` can be used via the core python `re` module, or the third-party `regex` module. Both the original code to be refactored for this exercise and the example solutions use the core `re` module to access `regular expressions` functionality. [markdown](../exercise-concepts/markdown.md) - A Domain Specific Language (DSL) for text processing. Like many other programming languages in use, python supports a quasi-dialect of PCRE (_Perl compatible regular expressions_). `Regular expressions` can be used via the core python `re` module, or the third-party `regex` module. Both the original code to be refactored for this exercise and the example solutions use the core `re` module to access `regular expressions` functionality. [markdown](../exercise-concepts/markdown.md)

View File

@@ -7,7 +7,7 @@ TODO: ADD MORE
- Most of the functions in the example solution specify a _return_ value using the `return` keyword. [markdown](../exercise-concepts/markdown.md) - Most of the functions in the example solution specify a _return_ value using the `return` keyword. [markdown](../exercise-concepts/markdown.md)
- the exercise must use a `return` statement to return a value to the caller [leap](../exercise-concepts/leap.md) - the exercise must use a `return` statement to return a value to the caller [leap](../exercise-concepts/leap.md)
- this function return a string by this line: `return text[::-1]` [reverse-string](../exercise-concepts/reverse-string.md) - this function return a string by this line: `return text[::-1]` [reverse-string](../exercise-concepts/reverse-string.md)
- the `return` keyword is used in a _return statement_ at the end of a function. Exits a function and may or may not pass data or an expression back to calling code. Functions in python without an expicit `return` keyword and statment will return (pass back) the singleton object `none`. The example code _returns_ a copy of the passed-in argument (assumed to be a string) that has been mapped through `str.translate()`, using the table made from `str.maketrans()` [rna-transcription](../exercise-concepts/rna-transcription.md) - the `return` keyword is used in a _return statement_ at the end of a function. Exits a function and may or may not pass data or an expression back to calling code. Functions in python without an explicit `return` keyword and statement will return (pass back) the singleton object `none`. The example code _returns_ a copy of the passed-in argument (assumed to be a string) that has been mapped through `str.translate()`, using the table made from `str.maketrans()` [rna-transcription](../exercise-concepts/rna-transcription.md)
- knowing that functions need not have _explicit_ return statements or values but will return `None` if `return` is not specified. Except for the two `@property`-decorated functions, all of the functions in the example omit an explicit `return` statment and all return `None`. [robot-simulator](../exercise-concepts/robot-simulator.md) - knowing that functions need not have _explicit_ return statements or values but will return `None` if `return` is not specified. Except for the two `@property`-decorated functions, all functions in the example omit an explicit `return` statement and all return `None`. [robot-simulator](../exercise-concepts/robot-simulator.md)
- the knowledge of `return` statement could be a useful concept in this exercise [variable-length-quantity](../exercise-concepts/variable-length-quantity.md) - the knowledge of `return` statement could be a useful concept in this exercise [variable-length-quantity](../exercise-concepts/variable-length-quantity.md)
- "row" and "column" list values are expected from defined instance method(s) [matrix](../exercise-concepts/matrix.md) - "row" and "column" list values are expected from defined instance method(s) [matrix](../exercise-concepts/matrix.md)

View File

@@ -4,4 +4,4 @@ TODO: ADD MORE
- the extended solution to this exercise can employ a slice (returns a copy) instead of calling `.copy()`. [matrix](../exercise-concepts/matrix.md) - the extended solution to this exercise can employ a slice (returns a copy) instead of calling `.copy()`. [matrix](../exercise-concepts/matrix.md)
- a slice within an iterable, i.e. the slice of items from `<iterable>[x]` to `<iterable>[y]`, can be accessed via `<iterable>[x:y]` notation; a third parameter allows "skipping" by `z`, i.e. `stringname[x:y:z]` [phone-number](../exercise-concepts/phone-number.md) - a slice within an iterable, i.e. the slice of items from `<iterable>[x]` to `<iterable>[y]`, can be accessed via `<iterable>[x:y]` notation; a third parameter allows "skipping" by `z`, i.e. `stringname[x:y:z]` [phone-number](../exercise-concepts/phone-number.md)
- becase `str` in Python is a sequence type, [slicing](https://docs.python.org/3/reference/expressions.html#slicings) syntax can be used here. Specifically: for syntax `string[start:stop:stride]`: [reverse-string](../exercise-concepts/reverse-string.md) - because `str` in Python is a sequence type, [slicing](https://docs.python.org/3/reference/expressions.html#slicings) syntax can be used here. Specifically: for syntax `string[start:stop:stride]`: [reverse-string](../exercise-concepts/reverse-string.md)

View File

@@ -3,4 +3,4 @@
TODO: ADD MORE TODO: ADD MORE
- The example solution uses `str.split()` to break the passed in markdown string into a list of lines broken up by the `\n` character. The alternate Python example solution uses `str.splitlines()` for the same effect across all line end characters. [markdown](../exercise-concepts/markdown.md) - The example solution uses `str.split()` to break the passed in markdown string into a list of lines broken up by the `\n` character. The alternate Python example solution uses `str.splitlines()` for the same effect across all line end characters. [markdown](../exercise-concepts/markdown.md)
- the example uses `str.split` with and without seperators to break the passed in string into "rows" and then "elements" [matrix](../exercise-concepts/matrix.md) - the example uses `str.split` with and without separators to break the passed in string into "rows" and then "elements" [matrix](../exercise-concepts/matrix.md)

View File

@@ -2,4 +2,4 @@
TODO: ADD MORE TODO: ADD MORE
- the `str.translate()` _instance method_ is called on an object from the `str` class (e.g. `<my string>`.translate()). Returns a copy of the inital string with each character re-mapped through the given _translation table_. The _translation table_ is typically a mapping or sequence type that implements indexing via the magic method `__getitem__()`. [rna-transcription](../exercise-concepts/rna-transcription.md) - the `str.translate()` _instance method_ is called on an object from the `str` class (e.g. `<my string>`.translate()). Returns a copy of the initial string with each character re-mapped through the given _translation table_. The _translation table_ is typically a mapping or sequence type that implements indexing via the magic method `__getitem__()`. [rna-transcription](../exercise-concepts/rna-transcription.md)

View File

@@ -2,4 +2,4 @@
TODO: ADD MORE TODO: ADD MORE
- In modern Python it's possibly to type hint annotations to parameters and variables, see [typing](https://docs.python.org/3/library/typing.html#module-typing). While not neccessary in Python such annotations can help your code be easier to read, understand, and check automatically using tools like `mypy`. [reverse-string](../exercise-concepts/reverse-string.md) - In modern Python it's possibly to type hint annotations to parameters and variables, see [typing](https://docs.python.org/3/library/typing.html#module-typing). While not necessary in Python such annotations can help your code be easier to read, understand, and check automatically using tools like `mypy`. [reverse-string](../exercise-concepts/reverse-string.md)

View File

@@ -60,7 +60,7 @@ class BinarySearchTree:
## Concepts ## Concepts
- [class][class]: a general comprehension of class concept and and how it works is required, `class` statement - [class][class]: a general comprehension of class concept and how it works is required, `class` statement
- [Implied Argument][implied-argument]: student needs to know how to use statement `self` in a class - [Implied Argument][implied-argument]: student needs to know how to use statement `self` in a class
- [class members][class-members]: student must know how members of a class work - [class members][class-members]: student must know how members of a class work
- [class methods][class-methods]: student must know how methods of a class work inside and outside the class, the use and meaning of `def` statement - [class methods][class-methods]: student must know how methods of a class work inside and outside the class, the use and meaning of `def` statement
@@ -78,5 +78,5 @@ class BinarySearchTree:
- [Integer comparison][integer-comparison]: concept required to solve the exercise - [Integer comparison][integer-comparison]: concept required to solve the exercise
- [Recursion][recursion]: recursion is a core concept in this exercise - [Recursion][recursion]: recursion is a core concept in this exercise
- [Lists][lists]: knowledge of lists and iteration on lists is required for this exercise - [Lists][lists]: knowledge of lists and iteration on lists is required for this exercise
- [Conditional structures][conditional-structures]: knowledge of conditional conceptis and `if...else` statements are required - [Conditional structures][conditional-structures]: knowledge of conditional concepts and `if...else` statements are required
- [Methods of list][methods-of-list]: the use of methods of list could be useful in this exercise. Methods like `append`, `pop`... - [Methods of list][methods-of-list]: the use of methods of list could be useful in this exercise. Methods like `append`, `pop`...

View File

@@ -18,7 +18,7 @@ def leap(year):
- [Modular Division][modular-division]: the exercise relies on the `%` operator to check if one number is evenly divisible by another - [Modular Division][modular-division]: the exercise relies on the `%` operator to check if one number is evenly divisible by another
- [Boolean Operators][boolean-operators]: the exercise relies on `and`, `or`, and (optionally) `not` to form Boolean predicates - [Boolean Operators][boolean-operators]: the exercise relies on `and`, `or`, and (optionally) `not` to form Boolean predicates
- [Boolean Logic][boolean-logic]: the exercise relies on `and` and `or` to combine Boolean predicates into a single logical answer - [Boolean Logic][boolean-logic]: the exercise relies on `and` and `or` to combine Boolean predicates into a single logical answer
- [Comparision][comparision]: the exercise relies on the `==` and `!=` operators to make binary comparisons between values - [Comparison][comparison]: the exercise relies on the `==` and `!=` operators to make binary comparisons between values
- [Equivalence][equivalence]: the exercise relies on the `==` and `!=` operators to check that two values are equivalent (or not) - [Equivalence][equivalence]: the exercise relies on the `==` and `!=` operators to check that two values are equivalent (or not)
- [Order of Evaluation][order-of-evaluation]: the exercise relies on parentheses to explicitly modify the normal order of evaluation of an expression - [Order of Evaluation][order-of-evaluation]: the exercise relies on parentheses to explicitly modify the normal order of evaluation of an expression
- [Operator Precedence][operator-precedence]: the exercise is most simply stated when the student understands the operator precedence binding rules of Python - [Operator Precedence][operator-precedence]: the exercise is most simply stated when the student understands the operator precedence binding rules of Python

View File

@@ -161,14 +161,14 @@ def parse(markdown: str) -> str:
- [Regular Expressions][regular-expressions]: Both the original code to be refactored for this exercise and the example solution import and use the `re` module for Regular Expressions in python. - [Regular Expressions][regular-expressions]: Both the original code to be refactored for this exercise and the example solution import and use the `re` module for Regular Expressions in python.
- [Importing][importing]: Both the original code to be refactored for the exercise and the example solution use the `import` keyword to import the `re` module in support of Regular Expressions in python. - [Importing][importing]: Both the original code to be refactored for the exercise and the example solution use the `import` keyword to import the `re` module in support of Regular Expressions in python.
- [String Splitting][string-splitting]: The example solution uses `str.split()` to break the passed in markdown string into a list of lines broken up by the `\n` character. The alternate Python example solution uses `str.splitlines()` for the same effect across all line end characters. - [String Splitting][string-splitting]: The example solution uses `str.split()` to break the passed in markdown string into a list of lines broken up by the `\n` character. The alternate Python example solution uses `str.splitlines()` for the same effect across all line end characters.
- [Regular Expressions][regular-expressions]: the `re.match()` function from the `re` module returns a `match` object with any matched values from a specified Regular Expression or pre-compliled Regular Expression. The example uses `re.match()` in multiple places to search for text patterns that need re-formatting or subsitituting. - [Regular Expressions][regular-expressions]: the `re.match()` function from the `re` module returns a `match` object with any matched values from a specified Regular Expression or pre-compiled Regular Expression. The example uses `re.match()` in multiple places to search for text patterns that need re-formatting or substituting.
- [Regular expressions][regular-expressions]: A Domain Specific Language (DSL) for text processing. Like many other programming languages in use, python supports a quasi-dialect of PCRE (_Perl compatible regular expressions_). `Regular expressions` can be used via the core python `re` module, or the third-party `regex` module. Both the original code to be refactored for this exercise and the example solutions use the core `re` module to access `regular expressions` functionality. - [Regular expressions][regular-expressions]: A Domain Specific Language (DSL) for text processing. Like many other programming languages in use, python supports a quasi-dialect of PCRE (_Perl compatible regular expressions_). `Regular expressions` can be used via the core python `re` module, or the third-party `regex` module. Both the original code to be refactored for this exercise and the example solutions use the core `re` module to access `regular expressions` functionality.
- [Return value][return-value]: Most of the functions in the example solution specify a _return_ value using the `return` keyword. - [Return value][return-value]: Most of the functions in the example solution specify a _return_ value using the `return` keyword.
- [None][none]: Pythons null type, referred to when a null or "placeholder" is needed. It is in and of itself a singleton in any given python program. - [None][none]: Pythons null type, referred to when a null or "placeholder" is needed. It is in and of itself a singleton in any given python program.
- [Booleans][booleans]: True and False of type `bopl`. The example solution uses `True` and `False` as return values from functions that test membership in a list of values. - [Booleans][booleans]: True and False of type `bool`. The example solution uses `True` and `False` as return values from functions that test membership in a list of values.
- [Assignment][assignment]: The example solution uses assignment for variables and other values. - [Assignment][assignment]: The example solution uses assignment for variables and other values.
- [Regular Expressions][regular-expression]: the `re.sub()` function of the `re` module that replaces a `regular expression` match with a new value. The example solutions use this function in various places to substitute _markdown_ syntax for _HTML_ syntax in the passed in markdown text. - [Regular Expressions][regular-expression]: the `re.sub()` function of the `re` module that replaces a `regular expression` match with a new value. The example solutions use this function in various places to substitute _markdown_ syntax for _HTML_ syntax in the passed in markdown text.
- [Dictionaries][dictionaries]: Mapping type. The example solution employes a dictionary to return values from the `parse_line()` function. - [Dictionaries][dictionaries]: Mapping type. The example solution employs a dictionary to return values from the `parse_line()` function.
- [For loops][for-loops]: The example solution uses `for` loops to iterate over various function inputs. - [For loops][for-loops]: The example solution uses `for` loops to iterate over various function inputs.
- [Iteration][iterable]: The example solution uses the `for _ in _` syntax to iterate over a list of lines. This is possible because a list is an `iterable`. - [Iteration][iterable]: The example solution uses the `for _ in _` syntax to iterate over a list of lines. This is possible because a list is an `iterable`.
- [Conditionals][conditionals]: The example solution uses `if` to check for pattern matching and membership conditions in different functions for processing different markdown patterns. - [Conditionals][conditionals]: The example solution uses `if` to check for pattern matching and membership conditions in different functions for processing different markdown patterns.

View File

@@ -53,17 +53,17 @@ class Matrix(object):
- [Classes][classes]: the exercise objective is to define a `matrix` type. Tested methods are linked to a `matrix` class - [Classes][classes]: the exercise objective is to define a `matrix` type. Tested methods are linked to a `matrix` class
- [Objects][objects]: creating different instances with different data representing different `matrices` is tested - [Objects][objects]: creating different instances with different data representing different `matrices` is tested
- [Constructor][constructor]: customizing object initalization with actions and persisting data. The example uses a constructor to process the passed in data into a list of lists assigned to an instance property - [Constructor][constructor]: customizing object initialization with actions and persisting data. The example uses a constructor to process the passed in data into a list of lists assigned to an instance property
- [Dunder Methods][dunder-methods]: the example uses the `__init__` magic method as its constructor for the class - [Dunder Methods][dunder-methods]: the example uses the `__init__` magic method as its constructor for the class
- [Return Values][return-value]: "row" and "column" list values are expected from defined instance method(s) - [Return Values][return-value]: "row" and "column" list values are expected from defined instance method(s)
- [Implicit Argument][implicit-argument]: the example uses the `self` implicit argument for methods and properties linked to a specific instance of the class - [Implicit Argument][implicit-argument]: the example uses the `self` implicit argument for methods and properties linked to a specific instance of the class
- [Namespaces][namespaces]: knowing to use `self`.`<propertyname>` for instance properties and `self` as first argument to instance methods in a class - [Namespaces][namespaces]: knowing to use `self`.`<propertyname>` for instance properties and `self` as first argument to instance methods in a class
- [Instance Methods][instance-methods]: tests for this exercises require one or more instance methods that will return a specified row or column list of the `matrix`. - [Instance Methods][instance-methods]: tests for this exercises require one or more instance methods that will return a specified row or column list of the `matrix`.
- [Instance Properties][instance-properties]: this exercise rquires one or more instance properties to persist passed in data. - [Instance Properties][instance-properties]: this exercise requires one or more instance properties to persist passed in data.
- [Mutability][mutability]: in the extended example, knowing there are no protected or private properties in python and adjusting coding patterns - [Mutability][mutability]: in the extended example, knowing there are no protected or private properties in python and adjusting coding patterns
- [Assignment][assignment]: instance properties need to be assigned passed in data - [Assignment][assignment]: instance properties need to be assigned passed in data
- [Method Arguments][method-arguments]: the methods returning "row" and "column" need to take both `self` and an integer as arguments - [Method Arguments][method-arguments]: the methods returning "row" and "column" need to take both `self` and an integer as arguments
- [Lists][lists]: this exercise requires "row" or "column" be returnd as a `list`. A `list` of `lists` is also the reccommended way to process and store the passed-in data. - [Lists][lists]: this exercise requires "row" or "column" be returned as a `list`. A `list` of `lists` is also the recommended way to process and store the passed-in data.
- [Indexing][indexing]: the "rows" and "columns" of this exercise need to be retrieved from a list of lists via index - [Indexing][indexing]: the "rows" and "columns" of this exercise need to be retrieved from a list of lists via index
- [Bracket Notation][bracket-notation]: knowing that `[]` should be used to refer to a value at a specific index in a list - [Bracket Notation][bracket-notation]: knowing that `[]` should be used to refer to a value at a specific index in a list
- [Slicing][slicing]: the extended solution to this exercise can employ a slice (returns a copy) instead of calling `.copy()`. - [Slicing][slicing]: the extended solution to this exercise can employ a slice (returns a copy) instead of calling `.copy()`.
@@ -71,9 +71,9 @@ class Matrix(object):
- [Iterables][iterables]: understanding that strings, lists, and other data structures can be iterated over in the same fashion - [Iterables][iterables]: understanding that strings, lists, and other data structures can be iterated over in the same fashion
- [Iterators][iterators]: the example solution for this exercise uses `zip()`, which returns an _iterator_. - [Iterators][iterators]: the example solution for this exercise uses `zip()`, which returns an _iterator_.
- [For Loop][for-loop]: iterating over the passed in `matrix` string using a `for` loop to extract "rows" and "columns" that are appended to a list - [For Loop][for-loop]: iterating over the passed in `matrix` string using a `for` loop to extract "rows" and "columns" that are appended to a list
- [Comprehension Syntax][comprehension-syntax]: knowing that this is equivelent to a `for loop` - putting the row or column creation code _inside_ the list literal instead of using loop + append. - [Comprehension Syntax][comprehension-syntax]: knowing that this is equivalent to a `for loop` - putting the row or column creation code _inside_ the list literal instead of using loop + append.
- [Zip][zip]: the example solution for this exercise uses this function to aggregage the column-wise elements of each rown list to form the matrix "columns". - [Zip][zip]: the example solution for this exercise uses this function to aggregate the column-wise elements of each row list to form the matrix "columns".
- [Argument Unpacking][argument unpacking]: the example solution for this exercise uses `splat` (`*`) to unpack rows for the `zip()` function. - [Argument Unpacking][argument unpacking]: the example solution for this exercise uses `splat` (`*`) to unpack rows for the `zip()` function.
- [String Splitting][string-splitting]: the example uses `str.split` with and without seperators to break the passed in string into "rows" and then "elements" - [String Splitting][string-splitting]: the example uses `str.split` with and without separators to break the passed in string into "rows" and then "elements"
- [Type Conversion][type-conversion]: the passed in data is in `str` format but the output is expected as a list of type `int`. - [Type Conversion][type-conversion]: the passed in data is in `str` format but the output is expected as a list of type `int`.
- [Int][int]: the example converts the parsed `str` elements into `int` - [Int][int]: the example converts the parsed `str` elements into `int`

View File

@@ -40,7 +40,7 @@ class PhoneNumber:
- [Class][class]: classes are defined with the `class <ClassName>:` syntax - [Class][class]: classes are defined with the `class <ClassName>:` syntax
- [Dunder Methods][dunder-methods]: User defined classes can (and generally do) overload the `__init__` method, whose first argument is `self`, because the result of `__init__` is a class _instance_. - [Dunder Methods][dunder-methods]: User defined classes can (and generally do) overload the `__init__` method, whose first argument is `self`, because the result of `__init__` is a class _instance_.
- [Inheritance][inheritance]: The default `__str___` method is inherited from `Object`, which every class in Python inherits from. (See: inheritance) - [Inheritance][inheritance]: The default `__str___` method is inherited from `Object`, which every class in Python inherits from. (See: inheritance)
- [Methods][methods]: classes can have instance _methods_ which are called from an instance of the class (as opposed to class methods, called from the Class itself). The first parameter of an instance method is always `self`, which is provided when calling from the instance (i.e. the programmer does not need to pass it as an argument explicitly). Static methods are methods called from the class itself, and are not connected to an instance of the class. They have access to class attributes (those defined on the class, not connected to the `self`), and do not require an instance of the class to exist. Classes can also define a `property` by using the `@property` decorator (not shown here); a `property` can be "lazily evaluated" to avoid uneeded computation - [Methods][methods]: classes can have instance _methods_ which are called from an instance of the class (as opposed to class methods, called from the Class itself). The first parameter of an instance method is always `self`, which is provided when calling from the instance (i.e. the programmer does not need to pass it as an argument explicitly). Static methods are methods called from the class itself, and are not connected to an instance of the class. They have access to class attributes (those defined on the class, not connected to the `self`), and do not require an instance of the class to exist. Classes can also define a `property` by using the `@property` decorator (not shown here); a `property` can be "lazily evaluated" to avoid unneeded computation
- [Non-Public Methods][non-public-methods]: Methods or attributes (including those of an imported module) prefixed with an underscore, `_`, are conventionally treated as "non-public" methods. Python does not support data privacy in the way a language like Java does. Instead convention dictates that methods and attributes that are not prefixed with a single underscore can be expected to remain stable along with semver, i.e. a public method will be backwards compatible with minor version updates, and can change with major version updates. Generally, importing non-public functions or using non-public methods is discouraged, though Python will not explicitly stop the programmer from doing so. - [Non-Public Methods][non-public-methods]: Methods or attributes (including those of an imported module) prefixed with an underscore, `_`, are conventionally treated as "non-public" methods. Python does not support data privacy in the way a language like Java does. Instead convention dictates that methods and attributes that are not prefixed with a single underscore can be expected to remain stable along with semver, i.e. a public method will be backwards compatible with minor version updates, and can change with major version updates. Generally, importing non-public functions or using non-public methods is discouraged, though Python will not explicitly stop the programmer from doing so.
- [Implied Argument][implied-argument]: within the class definition, methods and properties can be accessed via the `self.` notation - [Implied Argument][implied-argument]: within the class definition, methods and properties can be accessed via the `self.` notation
- [Inheritance][inheritance]: a "subclass" will inherit all methods, attributes from it's parent class, and can then override methods as needed. Overriding means the logic in the parent class is not used. The `super` builtin function (not shown here) exists to allow the programmer to defer logic up the inheritance chain to the parent class when needed. - [Inheritance][inheritance]: a "subclass" will inherit all methods, attributes from it's parent class, and can then override methods as needed. Overriding means the logic in the parent class is not used. The `super` builtin function (not shown here) exists to allow the programmer to defer logic up the inheritance chain to the parent class when needed.

View File

@@ -16,7 +16,7 @@ def reverse(text: str = "") -> str:
- [Immutability][immutability]: `text` str in Python is [immutable](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str). - [Immutability][immutability]: `text` str in Python is [immutable](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str).
In this exercise, you return a new string, the old string `text` is not changed. In this exercise, you return a new string, the old string `text` is not changed.
- [Return Value][return-value]: this function return a string by this line: `return text[::-1]` - [Return Value][return-value]: this function return a string by this line: `return text[::-1]`
- [Slicing][slicing]: becase `str` in Python is a sequence type, [slicing](https://docs.python.org/3/reference/expressions.html#slicings) syntax can be used here. Specifically: for syntax `string[start:stop:stride]`: - [Slicing][slicing]: because `str` in Python is a sequence type, [slicing](https://docs.python.org/3/reference/expressions.html#slicings) syntax can be used here. Specifically: for syntax `string[start:stop:stride]`:
- `start`: 0-index of the start position, `start=0` by default (i.e., not specified) (start from the beginning) - `start`: 0-index of the start position, `start=0` by default (i.e., not specified) (start from the beginning)
- `stop`: 0-index of the stop position, `stop=-1` by default (i.e., not specified) (stop at the end) - `stop`: 0-index of the stop position, `stop=-1` by default (i.e., not specified) (stop at the end)
@@ -31,4 +31,4 @@ def reverse(text: str = "") -> str:
[Extra material for string slicing.](https://www.digitalocean.com/community/tutorials/how-to-index-and-slice-strings-in-python-3) [Extra material for string slicing.](https://www.digitalocean.com/community/tutorials/how-to-index-and-slice-strings-in-python-3)
- [Docstrings][docstrings]: used to document the function, normally situated right below `def func():` - [Docstrings][docstrings]: used to document the function, normally situated right below `def func():`
- [Type hinting][type-hinting]: In modern Python it's possibly to type hint annotations to parameters and variables, see [typing](https://docs.python.org/3/library/typing.html#module-typing). While not neccessary in Python such annotations can help your code be easier to read, understand, and check automatically using tools like `mypy`. - [Type hinting][type-hinting]: In modern Python it's possibly to type hint annotations to parameters and variables, see [typing](https://docs.python.org/3/library/typing.html#module-typing). While not necessary in Python such annotations can help your code be easier to read, understand, and check automatically using tools like `mypy`.

View File

@@ -16,7 +16,7 @@ def to_rna(dna_strand):
- [Static Methods][static-methods]: Distinct from built-in functions, instance methods, and class methods, these are methods that are bound to a class, rather than an instance, and called _without_ explicitly or implicitly passing in an object of the class. The example solution for this exercise uses the `static` `str` method `maketrans`. - [Static Methods][static-methods]: Distinct from built-in functions, instance methods, and class methods, these are methods that are bound to a class, rather than an instance, and called _without_ explicitly or implicitly passing in an object of the class. The example solution for this exercise uses the `static` `str` method `maketrans`.
- [String Methods][string-methods]: this exercise uses `str.maketrans()` (a static method of `str` that returns a dictionary to create a _translation table_ as required by the `str.translate()` instance method. This method is unusual in that it takes either a single dictionary or two strings of equal length. The example solution for this exercise uses `str.maketrans()` with a two-string argument. - [String Methods][string-methods]: this exercise uses `str.maketrans()` (a static method of `str` that returns a dictionary to create a _translation table_ as required by the `str.translate()` instance method. This method is unusual in that it takes either a single dictionary or two strings of equal length. The example solution for this exercise uses `str.maketrans()` with a two-string argument.
- [Dictionary][dictionary]: mapping type that has key-value pairs. Returned by `str.maketrans` in the example code. Also one of the argument types accepted by `str.maketrans()`. - [Dictionary][dictionary]: mapping type that has key-value pairs. Returned by `str.maketrans` in the example code. Also one of the argument types accepted by `str.maketrans()`.
- [String Translation][string-translation]: the `str.translate()` _instance method_ is called on an object from the `str` class (e.g. `<my string>`.translate()). Returns a copy of the inital string with each character re-mapped through the given _translation table_. The _translation table_ is typically a mapping or sequence type that implements indexing via the magic method `__getitem__()`. - [String Translation][string-translation]: the `str.translate()` _instance method_ is called on an object from the `str` class (e.g. `<my string>`.translate()). Returns a copy of the initial string with each character re-mapped through the given _translation table_. The _translation table_ is typically a mapping or sequence type that implements indexing via the magic method `__getitem__()`.
- [Function][function]: A named (_and often reusable_) section of code that performs a specific task. It may or may not have _arguments_ passed in, and may or may not _return_ data. Created using the `def` keyword. - [Function][function]: A named (_and often reusable_) section of code that performs a specific task. It may or may not have _arguments_ passed in, and may or may not _return_ data. Created using the `def` keyword.
- [Function Arguments][function-arguments]: Parameters passed into a function. In python, these are noted in the `()` following a function name. The example code uses a function named `to_rna()` with an argument of `dna_strand`. - [Function Arguments][function-arguments]: Parameters passed into a function. In python, these are noted in the `()` following a function name. The example code uses a function named `to_rna()` with an argument of `dna_strand`.
- [Return Value][return-value]: the `return` keyword is used in a _return statement_ at the end of a function. Exits a function and may or may not pass data or an expression back to calling code. Functions in python without an expicit `return` keyword and statment will return (pass back) the singleton object `none`. The example code _returns_ a copy of the passed-in argument (assumed to be a string) that has been mapped through `str.translate()`, using the table made from `str.maketrans()` - [Return Value][return-value]: the `return` keyword is used in a _return statement_ at the end of a function. Exits a function and may or may not pass data or an expression back to calling code. Functions in python without an explicit `return` keyword and statement will return (pass back) the singleton object `none`. The example code _returns_ a copy of the passed-in argument (assumed to be a string) that has been mapped through `str.translate()`, using the table made from `str.maketrans()`

View File

@@ -67,8 +67,8 @@ class Robot:
- [Range][range]: the `range()` built-in type represents an immutable sequence of numbers (or any object that implements the `__index__` dunder method). Used in the example to represent the values from zero to 3 as assigned to NORTH, EAST, SOUTH, WEST. - [Range][range]: the `range()` built-in type represents an immutable sequence of numbers (or any object that implements the `__index__` dunder method). Used in the example to represent the values from zero to 3 as assigned to NORTH, EAST, SOUTH, WEST.
- [Class][class]: the exercise objective is to define a `robot` type. Tested methods are linked to a `robot` class. - [Class][class]: the exercise objective is to define a `robot` type. Tested methods are linked to a `robot` class.
- [Instantiation][instantiation]: creating different instances of the `robot` class with different data representing different starting positions and bearing are tested. - [Instantiation][instantiation]: creating different instances of the `robot` class with different data representing different starting positions and bearing are tested.
- [Initialization][initialization]: customizing object instatiation with actions and persisting data. The example uses `__init__` to persist a `compass` object and x, y coordinates assigned to instance attributes. - [Initialization][initialization]: customizing object instantiation with actions and persisting data. The example uses `__init__` to persist a `compass` object and x, y coordinates assigned to instance attributes.
- [Return Value][return-value]: knowing that functions need not have _explicit_ return statements or values but will return `None` if `return` is not specified. Except for the two `@property`-decorated functions, all of the functions in the example omit an explicit `return` statment and all return `None`. - [Return Value][return-value]: knowing that functions need not have _explicit_ return statements or values but will return `None` if `return` is not specified. Except for the two `@property`-decorated functions, all of the functions in the example omit an explicit `return` statement and all return `None`.
- [Implicit Argument][implicit-argument]: the example uses `self` for methods and properties linked to a specific instance of the class. - [Implicit Argument][implicit-argument]: the example uses `self` for methods and properties linked to a specific instance of the class.
- [Namespaces][namespaces]: knowing to use `self.<propertyname>` for instance attributes and `self` as first argument to instance methods in a class. Additionally, the example uses `self.<methodname>()` to call a previously stored method name. - [Namespaces][namespaces]: knowing to use `self.<propertyname>` for instance attributes and `self` as first argument to instance methods in a class. Additionally, the example uses `self.<methodname>()` to call a previously stored method name.
- [Instance Methods][instance-methods]: tests for this exercises require one or more instance methods that will take in a set of starting coordinates and a bearing and then accept a series of instructions that "move" the instance to a new set of coordinates and bearing. - [Instance Methods][instance-methods]: tests for this exercises require one or more instance methods that will take in a set of starting coordinates and a bearing and then accept a series of instructions that "move" the instance to a new set of coordinates and bearing.
@@ -76,11 +76,11 @@ class Robot:
- [Higher-Order Function][higher-order-function]: a function that takes one or more other functions as arguments, _returning_ a function as its return value. The example uses the built-in `property()` as a higher-order function through `@property`. - [Higher-Order Function][higher-order-function]: a function that takes one or more other functions as arguments, _returning_ a function as its return value. The example uses the built-in `property()` as a higher-order function through `@property`.
- [Property][property]: the `property()` built-in is a function that returns a property attribute. When used as a decorator, this transforms the passed-in method into a _getter_ method for read-only attribute with the same name and docstring. - [Property][property]: the `property()` built-in is a function that returns a property attribute. When used as a decorator, this transforms the passed-in method into a _getter_ method for read-only attribute with the same name and docstring.
- [Assignment][assignment]: the example uses assignment for all the instance properties and `instructions` dictionary. - [Assignment][assignment]: the example uses assignment for all the instance properties and `instructions` dictionary.
- [Instance Attributes][instance-attributes]: this exercise rquires one or more instance attributes to persist passed in data. - [Instance Attributes][instance-attributes]: this exercise requires one or more instance attributes to persist passed in data.
- [Mutability][mutability]: in the example, knowing there are no protected or private properties in python and so consciously mutating `self.x`, `self.y` and `self.compass` through the called instance methods. - [Mutability][mutability]: in the example, knowing there are no protected or private properties in python and so consciously mutating `self.x`, `self.y` and `self.compass` through the called instance methods.
- [Method Parameters][method-parameters]: the example `__init__` method has `self`, direction, x, and y (coordinates) as parameters. It also uses `self` and `commands` (a string) for parameters of the `move()` method. - [Method Parameters][method-parameters]: the example `__init__` method has `self`, direction, x, and y (coordinates) as parameters. It also uses `self` and `commands` (a string) for parameters of the `move()` method.
- [Default Arguments][default-arguments]: pre-setting function arguments to protect against them not being passed by a caller. The example uses `direction = NORTH` and `x=0, y=0` to ensure those values for a `robot` even if they are not initally passed. - [Default Arguments][default-arguments]: pre-setting function arguments to protect against them not being passed by a caller. The example uses `direction = NORTH` and `x=0, y=0` to ensure those values for a `robot` even if they are not initially passed.
- [Dictionary][dictionary]: the example uses a dictionary to map paassed in move arguments to methods that perform the moves. The example also uses a dictionary/mapping created by calling `str.maketrans()`. - [Dictionary][dictionary]: the example uses a dictionary to map passed in move arguments to methods that perform the moves. The example also uses a dictionary/mapping created by calling `str.maketrans()`.
- [Indexing][indexing]: finding a value by key in a dictionary using `<dictionary name>[<key name>]` The example uses passed in move arguments as `keys` to look up corresponding `values` (_method names_) for moving the robot in the _instructions_ dictionary. - [Indexing][indexing]: finding a value by key in a dictionary using `<dictionary name>[<key name>]` The example uses passed in move arguments as `keys` to look up corresponding `values` (_method names_) for moving the robot in the _instructions_ dictionary.
- [Iteration][iteration]: the example uses a `for loop` to iterate through the letters of the passed-in `commands` string and looks up the corresponding values in a dictionary, so that the appropriate methods can be called to move the `robot`. - [Iteration][iteration]: the example uses a `for loop` to iterate through the letters of the passed-in `commands` string and looks up the corresponding values in a dictionary, so that the appropriate methods can be called to move the `robot`.
- [Composition][composition]: adding functionality from a class by incorporating an instance of that class in a class you are creating. The example creates a `robot` by instantiating a `compass` and assigning it to the `self`.compass attribute of `robot`. - [Composition][composition]: adding functionality from a class by incorporating an instance of that class in a class you are creating. The example creates a `robot` by instantiating a `compass` and assigning it to the `self`.compass attribute of `robot`.