Function Name:
len
Function Signature:
len(tuple_in)
Function Overview:
- The len() function returns the total number of elements present in a Python tuple object.
- The len() function differs from the count() method of the tuple where the count() method returns the number of elements with a specific value.
Parameters:
tuple_in: The tuple object in which the total number of elements present, needs to be found.
Return Value:
An integer value specifying the number of elements in a Python tuple object.
Example:
# Example Python program that creates rainbowColors = ('Violet', 'Indigo', 'Blue', 'Green', 'Yellow', 'Orange', 'Red') |
Output:
Total number of elements present in the tuple: 7 |