i. The '
index()
' function returns the index of the first occurrence of the element in a tuple.
OUTPUT:
ii. The '
count()
' function returns the numbers of times the given element appears in the tuple.
OUTPUT:
iii.
'+'
operator concatenate the two tuples.
OUTPUT:
(23, 1, 45, 67, 45, 9, 55, 45, 100, 200)
iv. The '
len()
' function returns the number of elements in the given tuple.
OUTPUT:
v. The '
max()
' function returns the largest element of the tuple.
OUTPUT:
vi. The '
min()
' function returns the smallest element of the tuple.
OUTPUT:
vii. The '
sum()
' function returns the sum of all the elements of the tuple.
OUTPUT:
viii. The '
sorted()
' function takes element in the tuple and return a new sorted list. It doesn’t make any changes to the original tuple. Hence,
print(tuple1)
will print the original
tuple1
i.e.
(23, 1, 45, 67, 45, 9, 55, 45)
OUTPUT:
[1, 9, 23, 45, 45, 45, 55, 67]
(23, 1, 45, 67, 45, 9, 55, 45)