Lists and Tuples

Lists

Lists are ordered, changeable collections.

fruits = ["apple", "banana", "cherry"]
fruits.append("orange")
print(fruits)

Tuples

Tuples are ordered, unchangeable collections.

point = (10, 20)
print(point)

Use lists when you need to change items, and tuples when you don’t!


← Previous: Functions Next: Dictionaries and Sets →