This issue describes how to implement the other-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 set comprehensions and dict comprehensions in Python.
Learning objectives
- Understand how
set and dict comprehensions relate to their underlying data structures and the loop + append method of creating/computing them.
- Create a
dict comprehension from a loop + append
- Create a
set comprehension from a loop + append
- Create a
dict comprehension from Lists, Sets, Tuples, or other iterables (such as zip() or dict.items())
- Create a
set comprehension from Lists, Sets, Tuples, or other iterables (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 (of either flavor)
- Create a nested comprehension (of either flavor) with one or more formatting or filtering conditions
Out of scope
- Memory and performance characteristics and optimizations
generators and generator expressions in other comprehensions
- using the data structures in
collections in combination with, or as part of a set or dict comprehension.
- Using the
assignment expression (walrus operator) with either flavor of comprehension.
Concepts
dict-comprehensions
set-comprehensions
comprehension syntax
Prerequisites
basics
bools
conditionals
comparisons
loops
iteration
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
other-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
set comprehensionsanddict comprehensionsin Python.Learning objectives
setanddictcomprehensions relate to their underlying data structures and theloop+appendmethod of creating/computing them.dictcomprehension from aloop+appendsetcomprehension from aloop+appenddictcomprehension fromLists,Sets,Tuples, or otheriterables(such aszip()ordict.items())setcomprehension fromLists,Sets,Tuples, or otheriterables(such aszip()ordict.items())Out of scope
generatorsandgenerator expressionsinother comprehensionscollectionsin combination with, or as part of asetordictcomprehension.assignment expression(walrus operator) with either flavor of comprehension.Concepts
dict-comprehensionsset-comprehensionscomprehension syntaxPrerequisites
basicsboolsconditionalscomparisonsloopsiterationResources 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.