generated from mwc/lab_iteration
Assess lab_iteration
This commit is contained in:
parent
3ee046e9a5
commit
fe6a5f9c69
|
@ -0,0 +1,28 @@
|
|||
+++
|
||||
method = "completion"
|
||||
score = "complete"
|
||||
+++
|
||||
|
||||
Your tile is lovely! This would be fun to draw on a pen plotter...
|
||||
|
||||
In your ranges, you went to some trouble to include the maximum in the
|
||||
range (e.g. you interpreted "all numbers from 0 to 100" to include 100).
|
||||
This is a reasonable interpretation, but the convention in CS
|
||||
is that the lower number in a range is always included and the upper number
|
||||
is never included--matching the behavior of `range`:
|
||||
|
||||
>>> for i in range(2, 5):
|
||||
... print(i)
|
||||
2
|
||||
3
|
||||
4
|
||||
|
||||
This is just a convention, not something fundamentally right or wrong,
|
||||
but it ends up being convenient. Two nice properties:
|
||||
|
||||
- The size of the range is equal to `maximum - minimum`.
|
||||
- If you connect adjacent ranges (e.g. `range(0, 10)` and `range(10, 20)`),
|
||||
every number will be included exactly once.
|
||||
|
||||
Therefore, I would replace `maximum + 1` with `maximum` in your code--and I'd definitely
|
||||
be consistent (`print_even_numbers` includes maximum, but `print_odd_numbers` does not).
|
Loading…
Reference in New Issue