Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

LIST CREATION

RECAP ACTIVITY
1. What is a data
2. Discuss the different type of data types
LIST

 A list is a data structure in Python that is a mutable, or changeable, ordered


sequence of elements.
 EX: lst=[34,2,5,9]
 GROUP ACTIVITY
 Search and find out the uses of data structure in business analytics.
Create a list from a string
Critical thinking question
 Python allows you to create lists without specifying a fixed
size. What are the advantages and potential drawbacks of
dynamic list sizing compared to languages that require a
predefined array size? How does dynamic list sizing affect
memory and performance?
Activity 2
 Create a list from the string “programming”.
 A=list(‘programming’)
 print(A)
 Create an empty list.
 A=[]
 Create a list with numbers 8,6,0,1
 A=[8,6,0,1]
 Create a multi dimensional list with the numbers 6,5,4,7,8,9,3
 A=[6,5,[4,7,8],[9,3]]

Predict the output of following code.


 1) empty=[] 2) new=[2,4,5] 3) str=list(‘program’)
 print(str) print(new) print(str)
 [] [2,4,5] [‘p’,’r’,’o’,’g’,’r’,’a’,’m’]
 4) lst=[4,3,[6,7]]
 print(lst)
 [4,3,[6,7]]


Assignment:
Write a program to create a nested list of employee name and salary
and display the list.
Create a list using input
function
Create a nested list for storing
student name and mark using
input function.

You might also like