Python Collections - List, Tuple and Set.

188 views 7 slides Jan 30, 2024
Slide 1
Slide 1 of 7
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7

About This Presentation

Python Collections - List, Tuple and Set.


Slide Content

COLLECTIONS Presented To: Presented By: Deeksha

Table of contents What are Collections in Python? List Tuple Set

What are Collections in Python? Collections in Python are like containers used for storing data and are commonly known as data structures, such as lists, tuples, set, dictionaries, etc. Python has a built-in collections module providing additional data structures for collections of data. The Python collection was first introduced in the Python 2.4 version.

List List is a collection of data, where we can represent a group of values as a single entity. We separate the items with commas(,) and keep all the items of the entire list in square brackets[ ]. In list data type insertion order is preserved. Duplicate values are allowed. Heterogeneous objects are allowed. List data type is mutable. Append method is applicable. It is possible to use index elements. Slice operation is also applicable.

Tuple It is same as list data type, but tuple is immutable. Once a tuple is created , no changes can be made to it. In this, instead of square brackets[ ], parenthesis( ) is used . Index and slicing are allowed.

Set Set is an unordered collection of items (insertion order is not preserved). In set each element is unique, there is no duplicate element. Set elements can be represent within curly braces{ }. Set is mutable, we can use add and remove methods. Heterogeneous objects are allowed. Index and slice operators are not applicable.

Thankyou.