0% found this document useful (0 votes)
2 views2 pages

Datastructre Using Python

The document provides an overview of data structures in Python, focusing on lists, dictionaries, and tuples. It details various methods and operations for each data structure, including how to create, modify, and access elements. Lists are mutable and allow for operations like appending and sorting, while dictionaries store key-value pairs and tuples are immutable sequences.

Uploaded by

darshanmicroweb
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)
2 views2 pages

Datastructre Using Python

The document provides an overview of data structures in Python, focusing on lists, dictionaries, and tuples. It details various methods and operations for each data structure, including how to create, modify, and access elements. Lists are mutable and allow for operations like appending and sorting, while dictionaries store key-value pairs and tuples are immutable sequences.

Uploaded by

darshanmicroweb
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

Data structure and Algorithm In Python

Data Structure:

Data structure is a way to store the data into efficiently

Lists :

List is a very common data structure in python it allows a us to store the elements in sequentially
and each item is accessed by using technique called indexing .

Represented by A=[element1,element2,….element-n]

Example:

List=[10,20,30,40,50,60,70]

List methos in python operations

[Link]() adding the new element at the run time

[Link]() remove the element at last one or specified indexed item or pop(index)

[Link](element) search the element position.

[Link](element) return the how many times the specified element is repeated.

[Link]() it sort the unsorted list elements.

[Link](element) it remove the specified element in the list.

[Link]() it clear the all elements in the list and return the empty list .

[Link](index ,element) it insert the element at specified index.

[Link](list2) append or concatenate the another list items.

[Link]() it copy the entire list elements in the list.

[Link]() it makes the list elements reverse .

Dictionary:

The dictionary is one type of data Structure and it allows a us to store data in the key- value pairs.

The keys are immutable once it is created you cannot be modified.

Dictionary items are accessing using keys instead of using indexes .


Operations:-

Creating as dictionary:

d={} # it just creates the empty dictionary then we wanted to add the more items as well.

Adding the items:

d[keyname]=value

d[‘name’]=”darshan”

methods:

[Link]() # it will clear the entire items and return as empty dictionary.

[Link]({key1:value1, key2:vlaue2}) # used to add the multiple items at a time.

[Link](key,value) # it set the default of the key value when it is not exist.

[Link]() # used to copy the entire dictionary.

[Link](key) # it is used to remove the specific key-value item in the dictionary.

[Link]() # it will remove the last item in the dictionary.

[Link]() # it is used to get the only values in the dictionary

[Link]() # it is used to get the only keys in the dictionary

[Link]() # it is used to get the both key and value in the form of tuple .

[Link](key) # it is used to get the value as specified key as well.

Tuple:-

Tuple is a one type of data structure it is same as list but it is a immutable data structure we cannot
modify the values as declared

t=() # it creates a empty tuple in python

tuple as two methods

[Link](value) # it returns the specified value is how many time gets repeated .

[Link](value) # it get the index of specified value.

You might also like