Python Tuple and Sets

What are tuples?

Tuples are used to store a multiple items or objects under a single variable.

Tuples is a set of collections which are ordered and cannot be changed.

Tuples are enclosed within round brackets.

Tuples allow duplication.

Now let me take an example:

myvehicle = ("car", "bike", "bicycle")
print(myvehicle)

Python Set:

Python set functions like the same as a tuple, sets is used to store multiple data under a single variable.

They are enclosed within flower brackets.

Set do not allow duplication and only gives the output which is unique.

Sets are ordered and not changeable.

myvehicle = {"car", "bike", "bicycle"}
print(myvehicle)

For a visual clarity:

Python Tuple and Sets

Scroll to top