You are on page 1of 23

Session- 2 (Python)

Presented By : Amarjeet Singh


Corporate Trainer
Data Structure in Python

Data
Structure

Tuple List Dictionary Set


Tuple in Python
 Tuple is an ordered collection of elements enclosed within()

Tuples are
immutable Tup1=(101, “Amar”, 86.7)

Can not made any changes in tuple


Tuple Operations in Python

Extracting
Individual
Elements

Can’t make any changes


Tuple Operation in Python
Tuple Operation in Python
Repeat Tuple values
Tuple Functions in Python

Minimum value

Maximum Value
List in Python
 Tuple is an ordered collection of elements enclosed within[ ]

Lists are
mutable list=*101, “Amar”, 86.7+

Can make any changes in List


List Operation in Python
Modifying a List

Changing the elements in the list

Append elements in the list

Popping the last element from the list


Modifying a List

Reversing elements of a list

Sorting elements of a list

Inserting element at a specified Index


Basic Operation of a List
Concatenating Lists

Repeating Elements
Dictionary in Python
 Dictionary is an unordered collection of key-value pairs enclosed within{ }

Dictionary
is mutable Student=,“John” : 101, “Adam” : 20-
Key Value

Can make any changes in Dictionary


Dictionary Operation in Python
Extracting Keys and Values
Extracting Keys

Extracting Values
Modifying a Dictionary
Adding a new element

Changing an existing element


Dictionary Functions
Update an elements

Popping an element
Set in Python
 Set is an unordered and unindexed collection of elements enclosed with{ }

Duplicates are not


allowed in set
& Set is Mutable

Student={101, “John”, “MBA”-

Can make any changes in Set


Set Basics
Duplicates not allowed
Set Operations
Update one dictionary’s elements with another

Update multiple elements


Set Operations
Remove element
Set Operations
Union

Intersection

You might also like