YouTip LogoYouTip

Att Tuple Len

# Python2.x Python Tuple len() Method [![Image 3: Python Tuple](#)Python Tuple](#) * * * ## Description The Python tuple len() function calculates the number of elements in a tuple. ## Syntax The syntax for the len() method is: len(tuple) ## Parameters * tuple -- The tuple to be counted. ## Return Value The function returns the number of elements in the tuple. ## Example The following example demonstrates the usage of the len() function: #!/usr/bin/python tuple1, tuple2 = (123, 'xyz', 'zara'), (456, 'abc')print "First tuple length : ", len(tuple1);print "Second tuple length : ", len(tuple2); The output of the above example is: First tuple length : 3Second tuple length : 2 [![Image 4: Python Tuple](#)Python Tuple](#)
← Att Tuple MaxAtt List Max β†’