Lists and tuples are two data structures in Python that can be used to combine data into one unit.
Both data structures allow read access to the individual data.
While the data structure list allows a write access, such a write access is not possible with tuples.
Lists are data objects that can be changed in Python, tuples are data objects that cannot be changed.
Lists are surrounded by square brackets and separated by commas. [1, „Who will be the champion?“, 1904]
Numbers can simply be entered into the list, strings, on the other hand, must be enclosed in quotation marks.
Furthermore, there is the possibility of a nested list [[„Gelsenkirchen“, „Nürnberg“],[1900,1904],[„echte“, „Fanfreundschaft“]] or a deeply nested list [„Fußballclub“,[„Gelsenkirchen“,[„Schalke“,[„1904“]]]]
A tuple can be imagined as an unchangeable list. Tuples are defined in the same way as lists, except that round brackets are used instead of square brackets: („tuples“, „are“, „immudable“)
If it is known that data does not have to be changed, tuples should be used to avoid unwanted changes.