This issue describes how to implement the list-comprehensions 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:
Goal
The goal of this exercise is to teach the syntax and variants of list comprehensions in Python.
Learning objectives
- Understand how a
list comprehension relates to the loop + append method of creating/computing a List.
- Create a list comprehension from a
loop + append
- Create a list comprehension from a
string, List, or other iterable (such as zip() or dict.items())
- Use one or more conditions/operators/methods to filter comprehension inputs
- Use methods or logic to format the elements (output members) of the comprehension
- Create a nested comprehension
- Create a nested comprehension with one or more formatting or filtering conditions
Out of scope
- Memory and performance characteristics and optimizations
generators and generator expressions in list comprehensions
- How
map() and filter() relate to or differ from list comprehensions
- Using the
assignment expression (walrus operator) with a list comprehension
Concepts
Prerequisites
basics
bools
comparisons
conditionals
lists
list-methods
loops
iteration
sequences
Resources to refer to
Hints
After
comprehension syntax for other data structures such as sets and dictionaries
generators and generator expressions
generators and generator expressions in list comprehensions
Representer
No changes required.
Analyzer
No changes rquired.
Implementing
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
This issue describes how to implement the
list-comprehensionsconcept 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:
Goal
The goal of this exercise is to teach the syntax and variants of
list comprehensionsin Python.Learning objectives
list comprehensionrelates to theloop+appendmethod of creating/computing aList.loop+appendstring,List, or otheriterable(such aszip()ordict.items())Out of scope
generatorsandgenerator expressionsinlist comprehensionsmap()andfilter()relate to or differ fromlist comprehensionsassignment expression(walrus operator) with alist comprehensionConcepts
list-comprehensionsPrerequisites
basicsboolscomparisonsconditionalslistslist-methodsloopsiterationsequencesResources to refer to
Hints
List Comprehensionssection of the Python docs tutorial: List ComprehensionsAfter
comprehension syntaxfor other data structures such assetsanddictionariesgeneratorsandgenerator expressionsgeneratorsandgenerator expressionsinlist comprehensionsRepresenter
No changes required.
Analyzer
No changes rquired.
Implementing
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.