You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
This issue describes how to implement the tuples 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:
Create a tuple via constructor (tuple(_iterable_)), literal (a,b,c or (a, b, c)), & single literal (a, or (a,))
Understand that it is the comma in a sequence that makes a Tuple, and that the () are optional, except for denoting an empty Tuple or when omitting them creates ambiguity.
Understand that Tuples are an immutable data type (like Strings). Changing a Tuple means creating a new copy.
Understand that Tuples can contain other Tuples. (e.g. Tuples can be nested).
Create a new Tuple from two or more previous Tuples via concatenation using the + operator. * Create a new Tuple by multiplying a previous Tuple using the * operator.
Access values in a tuple via index & using [] (bracket notation).
Check for membership of an item in a given tuple.
Iterate through a tuple using for item in.
Out of scope
Sequence type methods such as min(), max(), x.index(), x.count(), len(), or hash()
Additional builtin functions as they relate to this data structure (e.g. sorted(), enumerate(), or reversed().
Slicing or slice notation ([start:stop:step])
Knowing that Tuples can be used as objects in other data structures, -- e.g. " a "List of Tuples", "Tuples as keys in Dictionaries", ,or "A Set of Tuples".
Create a new Tuple by multiplying a previous Tuple using the * operator.
Hints should link to the Tuples section of the Python docs tutorial: Tuples.
After
After, the student can explore slicing syntax, although it will be taught in separate exercises. This might also be a good time to explore the concept of hash-ability & the use of Tuples as keys in a dictionary. Additionally, the student can take a look at additional sequence type methods, or how built-in methods such as sorted(), enumerate(), min(), or max() can be used with Tuples.
Representer
No changes required.
Analyzer
No changes required.
Implementing
Tests should be written using unittest.TestCase, and the test file named dicts_basic_test.py.
Please see Implementing a Concept Exercise for additional instructions and details.
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
tuples
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 Tuple (sequence type, immutable Sequence type) data type in Python.
Learning objectives
tuple(_iterable_)
), literal (a,b,c
or(a, b, c)
), & single literal (a,
or(a,)
)()
are optional, except for denoting an empty Tuple or when omitting them creates ambiguity.+
operator.* Create a new Tuple by multiplying a previous Tuple using the*
operator.[]
(bracket notation).for item in
.Out of scope
min()
,max()
,x.index()
,x.count()
,len()
, orhash()
sorted()
,enumerate()
, orreversed()
.[start:stop:step]
)*
operator.namedtuple()
Concepts
Prerequisites
Resources to refer to
Hints
Hints should link to the Tuples section of the Python docs tutorial: Tuples.
After
After, the student can explore slicing syntax, although it will be taught in separate exercises. This might also be a good time to explore the concept of hash-ability & the use of Tuples as keys in a dictionary. Additionally, the student can take a look at additional sequence type methods, or how built-in methods such as
sorted()
,enumerate()
,min()
, ormax()
can be used with Tuples.Representer
No changes required.
Analyzer
No changes required.
Implementing
Tests should be written using unittest.TestCase, and the test file named dicts_basic_test.py.
Please see Implementing a Concept Exercise for additional instructions and details.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
Edits
len()
as out of scope.*
multiplication from learning objectives.The text was updated successfully, but these errors were encountered: