Important Notice:

Course Content
Tuples in Python (Chapter-8) M3-R5
About Lesson

creating tuple

 

i. Empty tuple:-

a=()

print(a)                                   # ( )

print(type(a))                        # <class ‘tuple’>

 

ii. Create Single value tuple:-

 a=5,

print(a)                                   # (5,)

print(type(a))                        # <class ‘tuple’>

 

iii. Create Multi value tuple:-

a=5,10,15,20,25

print(a)                                   # (5, 10, 15, 20, 25)

print(type(a))                        # <class ‘tuple’>

 

iv. Using Tuple function:-

a=[5,10,15,20,25]

print(a)                                   # [5, 10, 15, 20, 25]

print(type(a))                        # <class ‘list’>

b=tuple(a)

print(b)                                   # (5, 10, 15, 20, 25)

print(type(b))                        # <class ‘tuple’>

 

 

error: Content is protected !!