Commit da83124
Dictionary (Edit Word): Tuple (#126)
# Word
#### Tuple
# Updated Meaning/Definition
A tuple is a data structure that is an immutable, or unchangeable,
ordered sequence of elements. Because tuples are immutable, their values
cannot be modified.
Generally, tuples use less memory than a list or array.
Tuples allow for slicing and indexing like lists but do not have methods
for deleting or changing elements.
#### Key Characteristics of Tuples:
- **Immutable**: You cannot modify, add, or remove items after creating
the tuple.
- **Ordered**: Items in a tuple maintain their defined order.
- **Can Store Different Data Types**: Each element in a tuple can be of
any data type.
- **Supports Indexing**: Access elements using indices starting from 0.
**Example (Python)**
```python
# creating a tuple
mySiblings = ('Susan', 'James', 'Bryan')
# accessing an element within a tuple:
mySiblings[2]
```
---------
Co-authored-by: Olabode Lawal-Shittabey <babblebey@gmail.com>1 parent 16a7fbd commit da83124
1 file changed
Lines changed: 26 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments