-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.py
More file actions
39 lines (29 loc) · 838 Bytes
/
Copy pathtempCodeRunnerFile.py
File metadata and controls
39 lines (29 loc) · 838 Bytes
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
# Looping the array
# for name in names:
# print(name)
# # first element
# print(names[0])
# # Last element
# print(names[-1])
# # Length of the list/array
# print(len(names))
# # List methods
# # append() - adds an element to the list at the end
# names.append("mohamed")
# print(names)
# # clear() - clears the list
# # names.clear()
# # print(names)
# # count() - it returns the number of times an element appears in the list
# print(names.count("ali"))
# # insert - it adds an element to list at a specified index
# names.insert(2, "amina")
# print(names)
# # index - returns the first occurence of the element
# print(names.index("ali"))
# # pop - removes an element a specified position/index
# names.pop(3)
# print(names)
# # remove - removes the item with the specified value
# names.remove("yussuf")
# print(names)