Curriculum
Course: Data Analysis 2025 (Batch A)
Login

Curriculum

Data Analysis 2025 (Batch A)

Text lesson

Class Twenty-Eight: Text (Data structure)

Sort

My_var2= [20, 5, 10, 18,30, 4, 8, 6]

My_var2.sort()

Print(my_var2)

Clear

Student-name.clear()

Print (student_name)

count

student_name2.count(‘kelly’)

run it

 

TUPLE

Inserting values into tuple by separating each value with a comma.

Mytup = (2)

Print(mytup)

A= (2,3,4,6,9)

Print(type(A)

B= 2, 4, 6,9

Type(B)

A tuple with different data type

Mytup= (‘berry’, 10, ‘banana’)

Print (mytup)

Accessing items in a tuple using index

C= (2, 4, 6, 10, 7, 9)

A= C [2]

Print(A)

Using slicing to access a range of element

Print (C [1:4])

Find the index of an element (first occurrence)

Print (C. index (4))

Count

C. count (9)

Tuple packing and unpacking

Packed_tuple= 1,2,3

Print (packed_tuple)

Unpcked_tuple

X,y,z =packed_tuple

Print(x,y,z)

Nested tuple

A= ((0,1),(1,2),(2,3),(3,4))

Print(A)

Tuple containing list

D = (10,[4,1],[5,1])

Print (D)

Accessing with index

D [1] run

D [1] [0] run

SET

N = {‘pawpaw’, ‘orange’, ‘apple’, ‘banana’, ‘cherry’}

Print(N)

Add value to a set using the add method

N. add (grape)

Print (N)

Add value to set using update method

N1= (‘watermelon’, ‘lemon’)

N.update (N1)

Print(N)

Check membership

Print (‘watermelon in N1)

Remove element from a set

N . remove ( ‘banana’)

Print (N)

Using pop to remove an element from set

N.pop( )

Print (N)

Using removes to remove element from a set

N. remove (‘orange’)

Using discard to remove element

N. discard (‘apple’)

Print(N)

DICTIONARY

In Python, a dictionary is a mutable data type that stores mappings of unique keys to values.

Dictionaries are also known as associative arrays, hash tables, or maps in other programming languages.

A dictionary consists of key-value pairs, where each key is unique and maps to a specific value.

An example of a dictionary:

person = { “name”: “John Adesuwa”, “age”: 30,”city”: “Benin”,”marital_status”: “single”}

Print (person)

Access item in a dictionary using key

Print(person[“name”])

How to modify value in a dictionary

Person[“name”] =”peter frank

Person [“age”] = “40”

Print(person)