Python Tuples

Python Tuples

The tuples are used to store data Tuples are one of the other 4 data types but we can also add duplicate values in it, other data types of Python such as list set and directory are used for different tasks. Is

example

thistuple = ("rahul", "rohan", "sohan")
print(thistuple)

unchangeable

Tuples are unchangeable, which means that the value we have added to the tuples cannot be changed after that.

Add Duplicate Item

we can add duplicate value or item in tuples let’s take an example

thistuple = ("rahul", "banana", "rohan", "rahul", "rohan")
print(thistuple)

Tuples Lenght

we can check the length of tuples using len() Let’s take an example

thistuple = ("rahul", "rohan", "sohan")
print(len(thistuple))

Leave a Reply