Skip to content

Commit 664f1db

Browse files
authored
[Sieve]: Update content.md for Comprehension Approach (#3865)
Added language about the disallowed `%` operator to the Comprehensions approach.
1 parent c99a16e commit 664f1db

File tree

1 file changed

+2
-1
lines changed
  • exercises/practice/sieve/.approaches/comprehensions

1 file changed

+2
-1
lines changed

exercises/practice/sieve/.approaches/comprehensions/content.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def primes(limit):
2727
if all(number % divisor != 0 for divisor in range(2, number))]
2828
```
2929

30-
This second example using a `list-comprehension` with `all()` is certainly concise and _relatively_ readable, but the performance is again quite poor.
30+
This second example using a `list-comprehension` with `all()` is certainly concise and _relatively_ readable, but it uses **`%`** (_which the instructions ask you not to use_) and the performance is again quite poor.
31+
3132

3233
This is not quite a fully nested loop (_there is a short-circuit when `all()` evaluates to `False`_), but it is by no means "performant".
3334
In this case, scaling with input size is intermediate between linear and quadratic, so not quite as bad as the first example.

0 commit comments

Comments
 (0)