0% found this document useful (0 votes)
23 views1 page

Python Tuple Functions

The document outlines built-in tuple functions in Python, detailing their descriptions, syntax, and examples. Functions include any(), all(), count(), index(), len(), max(), min(), sorted(), sum(), and tuple(). Each function serves a specific purpose related to tuple manipulation and analysis.

Uploaded by

venkatasai012345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Python Tuple Functions

The document outlines built-in tuple functions in Python, detailing their descriptions, syntax, and examples. Functions include any(), all(), count(), index(), len(), max(), min(), sorted(), sum(), and tuple(). Each function serves a specific purpose related to tuple manipulation and analysis.

Uploaded by

venkatasai012345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Built-in Tuple Functions

Function Description Syntax Example

any() Returns True if any element is true any(tuple) any((0, 1, 2)) -> True

all() Returns True if all elements are true all(tuple) all((1, 2, 3)) -> True

count() Counts occurrences of an element tuple.count(item) (1, 2, 2, 3).count(2) -> 2

index() Returns index of first occurrence tuple.index(item) (1, 2, 3).index(2) -> 1

len() Returns number of elements len(tuple) len((1, 2, 3)) -> 3

max() Returns maximum element max(tuple) max((1, 2, 3)) -> 3

min() Returns minimum element min(tuple) min((1, 2, 3)) -> 1

sorted() Returns sorted list of elements sorted(tuple) sorted((3, 1, 2)) -> [1, 2, 3]

sum() Returns sum of elements sum(tuple) sum((1, 2, 3)) -> 6

tuple() Converts iterable to a tuple tuple(iterable) tuple([1, 2, 3]) -> (1, 2, 3)

You might also like