0 added
0 removed
Original
2026-01-01
Modified
2026-02-21
1
<p>A<strong>list</strong>is a data structure designed to store ordered sets of elements.</p>
1
<p>A<strong>list</strong>is a data structure designed to store ordered sets of elements.</p>
2
<p>In this case, the word "ordered" means we store the structural elements in the order in which we added them.</p>
2
<p>In this case, the word "ordered" means we store the structural elements in the order in which we added them.</p>
3
<p>Items in the list are indexed, meaning they have a number that tells you their position. The numbering always starts<strong>from zero</strong>and is always<strong>monotonous</strong>. It means that each subsequent item index increases by one - this numbering is also called continuous numbering. If you delete items at the beginning or middle of the list or insert items in the middle, Python recalculates the indexes and preserves the above numbering properties.</p>
3
<p>Items in the list are indexed, meaning they have a number that tells you their position. The numbering always starts<strong>from zero</strong>and is always<strong>monotonous</strong>. It means that each subsequent item index increases by one - this numbering is also called continuous numbering. If you delete items at the beginning or middle of the list or insert items in the middle, Python recalculates the indexes and preserves the above numbering properties.</p>
4
<h2>Immutability and modifiability</h2>
4
<h2>Immutability and modifiability</h2>
5
<p>We already know that concatenating two lines results in a new line, and adding two numbers results in a number.</p>
5
<p>We already know that concatenating two lines results in a new line, and adding two numbers results in a number.</p>
6
<p>Tuples, which we looked at earlier:</p>
6
<p>Tuples, which we looked at earlier:</p>
7
<ul><li>Allow you to group the elements and then break the group into components</li>
7
<ul><li>Allow you to group the elements and then break the group into components</li>
8
<li>Can be combined into a larger tuple</li>
8
<li>Can be combined into a larger tuple</li>
9
<li>Don't allow you to change the composition of the elements - instead, create new tuples from the elements of the old ones</li>
9
<li>Don't allow you to change the composition of the elements - instead, create new tuples from the elements of the old ones</li>
10
</ul><p>Earlier, we discussed many data types and structures, such as strings, numbers, Boolean values, and tuples. They are immutable, meaning that once we create them, they don't change.</p>
10
</ul><p>Earlier, we discussed many data types and structures, such as strings, numbers, Boolean values, and tuples. They are immutable, meaning that once we create them, they don't change.</p>
11
<p>Lists are the first data structure that can change its contents on the fly. These objects are called changeable objects. However, some list operations still create new lists based on old lists.</p>
11
<p>Lists are the first data structure that can change its contents on the fly. These objects are called changeable objects. However, some list operations still create new lists based on old lists.</p>