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

9. Basic data structures - 1[1]

Uploaded by

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

9. Basic data structures - 1[1]

Uploaded by

afsanaasgar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

BASIC DATA

STRUCTURES
Part - 1

Python trainer :
Chenna Kesava Rao Ramisetti
Data Structure

• A data structure is a way of


organizing and storing data
so that it can be accessed
efficiently.
• It's like a container that
holds data in a specific
arrangement, enabling
various operations on that
data.
List
• List is a collection of homogenous or heterogenous data
types.
• List is capable of storing any type of data.
• List is mutable data type. So, we can perform insertion,
deletion and updating operations on list.
• We can concatenate multiple lists.
• List is a ordered data type. So, it allows both negative
and positive indexing.
• Creating empty list === [ ], list()
• We can use membership operators like in and not in on
list.
List Indexing and Slicing
• List has both negative and positive indexing.
• Slicing has 3 parameters start, stop and step.
List methods
• append - adding new value at end of the list
• extend - adding multiple values to the list
• remove - deleting specific element from list
• clear - deleting all the elements from list
• copy - copying the elements of list into new list
• count - count of specific element in the list
• len - number of elements in the list
• index - index of specific element from list
• insert - inserting the new element at particular index position
• pop - used to remove an element from the list
• max - maximum number in the list
• min - minimum number in the list
• reverse - reverse the list items
• sum - sum of all elements in list
Tuple
• Tuple is a collection of homogeneous or heterogeneous
data types.
• Tuple is capable of storing any type of data.
• Tuple is immutable data type. So, we can not perform
insertion, deletion and updating operations on Tuple.
• We can concatenate multiple tuples.
• Tuple is a ordered data type. So, it allows both negative
and positive indexing.
• Creating empty Tuple === ( ), tuple()
• We can use membership operators like in and not in on
tuple.
Tuple methods
• count - count of specific element in the tuple
• index - index of specific element from tuple
• max - maximum number in the tuple
• min - minimum number in the tuple
• len - number of elements in the tuple
• Del - destroy the tuple
• sum - adds all values in the tuple

You might also like