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

Tuple Functions in Python

Tuples in Python are immutable sequences used to store multiple items. The document outlines commonly used tuple functions such as len, max, min, sum, and methods like count and index. These functions allow for operations like retrieving the number of items, finding the largest or smallest item, and converting sequences into tuples.

Uploaded by

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

Tuple Functions in Python

Tuples in Python are immutable sequences used to store multiple items. The document outlines commonly used tuple functions such as len, max, min, sum, and methods like count and index. These functions allow for operations like retrieving the number of items, finding the largest or smallest item, and converting sequences into tuples.

Uploaded by

lmg.ashmitadas
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Tuple Functions in Python

In Python, tuples are immutable sequences used to store multiple items in a single variable.
They are similar to lists but cannot be changed after creation. Below are all the commonly
used tuple functions and operations.

Built-in Tuple Functions and Methods:


 len(tuple)
Returns the number of items in the tuple.
 max(tuple)
Returns the largest item in the tuple (elements must be comparable).
 min(tuple)
Returns the smallest item in the tuple (elements must be comparable).
 sum(tuple)
Returns the sum of all numeric items in the tuple.
 tuple(sequence)
Converts a sequence (like list or string) into a tuple.
 count(value)
Returns the number of times a specified value appears in the tuple.
 index(value)
Returns the first index of the specified value. Raises ValueError if not found.

You might also like