generated from FarhaKousar1601/GlobalCoreTech-DataScience-Internship
-
Notifications
You must be signed in to change notification settings - Fork 3
/
day3lst.py
36 lines (25 loc) · 911 Bytes
/
day3lst.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
list1 =[1,2,3,4,5,6,7,8,9]
list2 = ["Zubida","Ismail","Zainba","Muhammed","Almas","Ayesha","Misba","Farha"]
print(list1)
print(list2) #print list1&list2
print(len(list1))
print(len(list2)) #length of list 1 and list2
print(list1[-1])
print(list2[-1]) #last element of list1 & list2
print(list1[0])
print(list2[0]) #Access the first element of list1 & list2
print(list2[-5:-4]) #negative indexing middle word of the list2
list2[3] = "uppa"
print(list2) #change the middle value of the list2
list1.insert(5,12)
list2.insert(5,"Syed")
print("Updated list1:", list1)
print("Updated list2:", list2) #Insert value at the 5th index of the lists
list1.append(14)
list2.append("Family")
print(list1)
print(list2) #Append function add value at end of lists
list1.remove(6)
list2.remove("Syed")
print(list1)
print(list2) #remove functionof any value