-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lists_functions.py
51 lines (31 loc) · 1.03 KB
/
Lists_functions.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
numbers = [0,1,2,3,4,5]
friends = ["Asmaa","Bassant","Maha","Aya","Noor","Kholoud"]
friends.sort()
print(friends)
print("*********************************")
friends.reverse()
print(friends)
print("*********************************")
friends.extend(numbers) #concatenate numbers list to friends list
print(friends)
print("*********************************")
friends.append("Great") #append an item to the end of the list
print(friends)
print("*********************************")
friends.insert(1,15) #append 15 at position 1
print(friends)
print("*********************************")
friends.remove(15)
print(friends)
print("*********************************")
friends.pop() #pops the last element in the list
print(friends)
print("*********************************")
print(friends.index("Maha"))
print(friends.count("Maha"))
friends2 = friends.copy()
print("*********************************")
friends.clear()
print(friends)
print("*********************************")
print(friends2)