You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Konstantin Schmidt edited this page Apr 28, 2019
·
2 revisions
List is a collection which is ordered and changeable. Allows duplicate members.
In Python lists are written with square brackets.
thislist = ["apple", "banana", "cherry"]
Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
In Python tuples are written with round brackets.
thistuple = ("apple", "banana", "cherry")
Set is a collection which is unordered and unindexed. No duplicate members.
In Python sets are written with curly brackets. Sets are unordered, so the items will appear in a random order!
thisset = {"apple", "banana", "cherry"}
Dictionary is a collection which is unordered, changeable and indexed. No duplicate members.
In Python dictionaries are written with curly brackets, and they have keys and values.