tuple suryapriya
PYTHON PROGRAMMING TUPLE
TUPLE:
1 .Tuple is a collection of data which separated by commas.
2 .Tuples are immutable.
EXAMPLE:
a=(1,2,3,'hello',34.2)
TUPLES METHOD:
1.INDEX ( ):
index() method searches for the given element in a tuple and returns its position. It returns first occurrence of the element in the tuple. Index starts from 0 and end at n-1. where n is length of tuple
EXAMPLE:
2.COUNT ( ):
count() method counts the occurrence of an element in the tuple. It required a parameter which is to be counted. If the item is missing in the tuple, it simply returns 0.
EXAMPLE:


Comments
Post a Comment