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
Copy file name to clipboardExpand all lines: concepts/tuples/introduction.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,6 @@ The elements of a tuple can be iterated over using the `for item in <tuple>` con
7
7
If both element index and value are needed, `for index, item in enumerate(<tuple>)` can be used.
8
8
Like any sequence, elements within `tuples` can be accessed via _bracket notation_ using a `0-based index` number from the left or a `-1-based index` number from the right.
Copy file name to clipboardExpand all lines: exercises/concept/tisbury-treasure-hunt/.docs/hints.md
+10-9
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@
3
3
## General
4
4
5
5
6
-
[Tuples][tuples] are immutable [sequence Types][sequence types] that can contain any data type.
7
-
Tuples are [iterable][iterable], and elements within tuples can be accessed via [bracket notation][bracket notation], using a zero-based index from the left, or -1 from the right.
8
-
Other [Common Sequence Operations][common sequence operations] can also be used when working with tuples.
6
+
-[Tuples][tuples] are immutable [sequence Types][sequence types] that can contain any data type.
7
+
-Tuples are [iterable][iterable]. If you need indexes as well as values, use [`enumerate()`][enumerate]
8
+
- Elements within tuples can be accessed via [bracket notation][bracket notation], using a zero-based index from the left, or -1 from the right. Other [Common Sequence Operations][common sequence operations] can also be used when working with tuples.
9
9
10
10
## 1. Extract coordinates
11
11
@@ -35,14 +35,15 @@ Other [Common Sequence Operations][common sequence operations] can also be used
35
35
- There are multiple textual formatting options available via Pythons [`format specification mini-language`][format specification mini-language].
Copy file name to clipboardExpand all lines: exercises/concept/tisbury-treasure-hunt/.docs/introduction.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,11 @@
3
3
In Python, a [tuple][tuple] is an _immutable_ collection of items in _sequence_.
4
4
Like most collections, `tuples` can hold any (or multiple) data type(s) -- including other `tuples`.
5
5
Tuples support all [common sequence operations][common sequence operations], but **do not** support [mutable sequence operations][mutable sequence operations].
6
+
6
7
The elements of a tuple can be iterated over using the `for item in <tuple>` construct.
7
8
If both element index and value are needed, `for index, item in enumerate(<tuple>)` can be used.
8
9
Like any sequence, elements within `tuples` can be accessed via _bracket notation_ using a `0-based index` number from the left or a `-1-based index` number from the right.
10
+
Tuples can also be copied in whole or in part using slice notation (_`<tuple>[<start>:<stop>:<step>]`_).
0 commit comments