0% found this document useful (0 votes)
7 views

Python Tuple

The document provides an overview of Python tuples, detailing their characteristics as immutable collections of elements that can be homogeneous or heterogeneous. It explains how to create tuples through tuple packing and highlights key functions such as len(), sorted(), max(), min(), sum(), and tuple() for manipulating tuples. The agenda includes a practice exercise for applying the concepts learned about tuples.

Uploaded by

akshitat699
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Python Tuple

The document provides an overview of Python tuples, detailing their characteristics as immutable collections of elements that can be homogeneous or heterogeneous. It explains how to create tuples through tuple packing and highlights key functions such as len(), sorted(), max(), min(), sum(), and tuple() for manipulating tuples. The agenda includes a practice exercise for applying the concepts learned about tuples.

Uploaded by

akshitat699
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Python Programming-

BCSG0001

Priya Agrawal (Technical Trainer)


Department of Training & Development (TND)
AGENDA ?
 Python tuple
 Tuple practice exercise
Python Tuple Collection of elements . (A finite sequence of terms.)

• Tuple is a collection of Python objects much like a list.

• Can be Homogeneous (similar data type) or Heterogeneous (data type different types)

• In Python, tuples are created by placing sequence of values separated by


‘comma’ with or without the use of parentheses for grouping of data sequence.
Note – Creation of Python tuple without the use of parentheses is known
as Tuple Packing.
• Tuples are IMMutable ~ cannot altered after creation.

rows or tuples
Creating a Tuple

Tuple Packing
Creating a Tuple

X
‘tpl’ is
integer
type
Note: In case your generating
a tuple with a single element,
make sure to add a comma
after the element.
len() Returns length of the tuple or size of the tuple

sorted() input elements in the tuple and return a new sorted


list

max() return maximum element of given tuple

min() return minimum element of given tuple

sum() Sums up the numbers in the tuple

tuple() Convert an iterable to a tuple.

You might also like