Q.“Lists and Tuples are ordered”. Explain.
Lists and tuples are sequences: every element sits at a fixed, numbered position (index), insertion order is preserved, and equality depends on order — that is what "ordered" means (not "sorted").
What "ordered" means. A list or tuple stores its elements in a definite sequence — the order in which they were inserted/created. Each element therefore has a position (index): 0, 1, 2, … from the front and -1, -2, … from the back. The structure remembers and preserves this arrangement; it never rearranges itself.
What follows from being ordered:
- Index access. You can ask for "the element at position 2" — meaningless in an unordered collection.
- Order distinguishes values. (10, 20) and (20, 10) contain the same elements but are unequal, because order is part of the identity of a sequence.
- Stable iteration and slicing. A for loop visits elements first-to-last, and slices like t[1:3] pick a contiguous run of positions.
Demonstration:
myList = [10, 20, 30, 40]
myTup = (10, 20, 30, 40)
print(myList[0], myList[-1]) # position-based access
print(myTup[1:3]) # slicing follows stored order
print([10, 20] == [20, 10]) # same elements, different order
print((10, 20) == (20, 10))
# contrast with an UNORDERED type:
print({10, 20} == {20, 10}) # sets ignore order
10 40
(20, 30)
False
False
True
The contrast that completes the answer: a set or the keys of an old-style mapping are unordered collections — no indexing, no slicing, and element order carries no meaning. That is exactly what lists and tuples are not.
"Ordered" does not mean "sorted". [30, 10, 20] is a perfectly ordered list — its order is 30-then-10-then-20, and Python preserves precisely that.
"Lists and tuples are ordered" means their elements are stored at fixed indexed positions preserving insertion order — enabling index access and slicing, and making order part of equality ((10,20) != (20,10)); the only difference between the two is that lists are mutable while tuples are immutable.
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.