Closed DavidGerva closed 3 years ago
@DavidGerva @cmccandless -- I really really hate doing this. But when I look at this concept exercise, it feels as though it belongs either with iterables
, iteration
or loops
as a concept -- and not on its own as a stand-alone. Thoughts?
I don't really think range
is a separate concept. It's not a keyword or a type, it's just a builtin function (albeit a common one).
Yeah. It is a "shortcut" sequence type for counting or iterating. So that us lazy pythonistas don't have to always declare a loop counter. ;-). And the python docs sorta treat it as such. Ok. Booting. This concept thing is .... frustrating. Apologies to the both of you for the churn and chaos.
This concept thing is .... frustrating. Apologies to the both of you for the churn and chaos.
Not at all! The only stupid questions are the ones left un-asked :smile:
This issue describes how to implement the
range
type concept exercise for the Python track: should explain whatrange
is and how to use it in python.Getting started
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:
Please also watch the following video:
Goal
Goal of the exercises is to teach the student the use of the
range
type, an immutable sequence of numbers in python.range
is commonly used for looping a specific number of times infor
loops.Learning objectives
range
typerange
to loop a number of timesrange
to loop a number of times with a specific step withrange(start, stop, step)
range
to create a list of integerOut of scope
Concepts
range
typePrerequisites
basics
iterable
for
loopResources to refer to
Hints
After
Go deeper inside the
range
call: exception handling for step passed 0 (If a step is zero Python raises aValueError
exception), explain how to use it with negative arguments. Spend some words on the advantage of therange
type over a regularlist
ortuple
: arange
object will always take the same (small) amount of memory, no matter the size of the range it represents (as it only stores the start, stop and step values, calculating individual items and subranges as needed).Representer
No changes required.
Analyzer
No changes required.
Implementing
Tests should be written using unittest.TestCase and the test file named comparisons_test.py.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
Edits
-