This issue describes how to implement the lists concept exercise for the Python track.
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:
The goal of this exercise is to teach the basics of the List (sequence type) data type in Python. We will accomplish this by requiring the student to create lists via various methods, iterate through a list via loop, access items in the list at a certain index, and form/access slices of the list.
Learning objectives
Create a list via constructor (list()) & literal ([])
Combine two or more lists by concatenation via +
Check for an items membership/absence in a list using in and/or not in
Access items in a list via index (bracket notation)
Access a range of items in a list via list slicing ([start:stop:step])
Iterate through a list using for item in
Understand that lists can store mixed/any data types
Understand that lists are mutable. Assigning a new value to a list index will change the value at that index.
Out of scope
List Comprehensions (these will be covered in their own concept exercise)
List methods (copy(), append(), sort() etc)
How builtin functions relate to lists (len(), max(), min(), count(), sorted())
Construction of complex or nested lists (i.e a list of dicts, a list of lists, a list of tuples)
After, the student can explore the list comprehension pattern, even though it will be taught separately. This is also a good time to reference some builtin methods like len(), or max() - not as a teaching item, but to expose the student to their existence and build familiarity.
Representer
No changes required.
Analyzer
No changes required.
Implementing
Tests should be written using unittest.TestCase, and the test file named lists_basic_test.py.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
Edits
edited for updated naming by @yawpitch
edited to add additional learning objectives by @BethanyG.
edited to clarify out of scope language by @BethanyG
This issue describes how to implement the
lists
concept exercise for the Python track.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
The goal of this exercise is to teach the basics of the
List
(sequence type) data type in Python. We will accomplish this by requiring the student to create lists via various methods, iterate through a list via loop, access items in the list at a certain index, and form/access slices of the list.Learning objectives
list
via constructor (list()
) & literal ([]
)+
in
and/ornot in
bracket notation
)[start:stop:step]
)for item in
lists
can store mixed/any data typeslists
are mutable. Assigning a new value to a list index will change the value at that index.Out of scope
copy()
,append()
,sort()
etc)len()
,max()
,min()
,count()
,sorted()
)lists
(i.e a list ofdicts
, alist
oflists
, alist
oftuples
)Concepts
lists
Prerequisites
Resources to refer to
Python lists doc
Hints
Hints should link to the
list
instance methods doc page.After
After, the student can explore the list comprehension pattern, even though it will be taught separately. This is also a good time to reference some builtin methods like
len()
, ormax()
- not as a teaching item, but to expose the student to their existence and build familiarity.Representer
No changes required.
Analyzer
No changes required.
Implementing
Tests should be written using
unittest.TestCase
, and the test file namedlists_basic_test.py
.Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
Edits