Skip to content

Commit 5854d9a

Browse files
Update mentoring.md (#2350)
I have corrected some spelling mistakes.
1 parent 57b0d21 commit 5854d9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tracks/python/exercises/perfect-numbers/mentoring.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ A simple optimization is to use `range(1, number // 2 + 1)` as the `for` loop `i
2929
This halves the complexity of the solution.
3030

3131
For a more efficient solution, one can compute all the factors by using the smaller `range(1, int(math.sqrt(number)) + 1)` as the `iterable`.
32-
This solution is longer and more involved but significantly faster, reducing the complextiy from `O(n)` (_linear_) to `O(sqrt(n))` (_square root_).
32+
This solution is longer and more involved but significantly faster, reducing the complexity from `O(n)` (_linear_) to `O(sqrt(n))` (_square root_).
3333

3434
```python
3535
def classify(number):
@@ -49,5 +49,5 @@ def classify(number):
4949

5050
Students unfamiliar with `generator expressions` might write: `aliquot = sum([item for item in range(1, number) if number % item == 0])`.
5151
Note this first creates a `list` of factors in memory by iterating over the entire range, then iterates once more over the `list` to `sum()` its values.
52-
This is inefficent for both memory and processing time.
53-
Dropping the `[]` drops `list` creation and allows `sum()` to lazily process a `generator expression`, wich only requires a single iteration and a smaller memory footprint.
52+
This is inefficient for both memory and processing time.
53+
Dropping the `[]` drops `list` creation and allows `sum()` to lazily process a `generator expression`, which only requires a single iteration and a smaller memory footprint.

0 commit comments

Comments
 (0)