Important Notice:

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

Properties of Tuple:-

 

i. Tuple object create करने के लिए , ( ) parenthesis का प्रयोग करते हैं।

ii. Tuple insertion order को follow करता है।

iii. Tuple में duplicate item allowed हैं।

iv. Tuple में Heterogeneous element allowed हैं।

v. Tuple positive & negative दोनों index को support करता है।

 

Note:- Tuple में element को represent करने कि लिए (,) separator का use करते हैं, parenthesis ( ) optional होता है।

Eg.1.    a=50,40,30,20

print(a)                                                # (50, 40, 30, 20)

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

 

Eg. 2.   a=50                                       

print(a)                                                # 50

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

Eg. 3.   a=50,

print(a)                                                #  (50,)

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

 

Eg. 4.   a=(50)

print(a)                                                # 50

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

 

Eg. 5.   a=(50,)

print(a)                                                # (50,)

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

 

 

Properties of Tuple:-

 

i. To create Tuple object, use ( ) parenthesis.

ii. Tuple follows the insertion order.

iii. Duplicate items are allowed in Tuple

iv. Heterogeneous elements are allowed in tuple

v. Tuple supports both positive & negative indexes.

 

Note:- To represent elements in a tuple, the (,) separator is used, parenthesis ( ) is optional.

Eg.1.    a=50,40,30,20

print(a)                                                # (50, 40, 30, 20)

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

 

Eg. 2.   a=50                                       

print(a)                                                # 50

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

Eg. 3.   a=50,

print(a)                                                #  (50,)

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

 

Eg. 4.   a=(50)

print(a)                                                # 50

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

Eg. 5.   a=(50,)

print(a)                                                # (50,)

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

error: Content is protected !!