-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6_lists.py
More file actions
41 lines (29 loc) · 722 Bytes
/
6_lists.py
File metadata and controls
41 lines (29 loc) · 722 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
40
41
demo_list = [1,"Hola",True,[4,5,6,1,9],12.3];
colors = ["red", "green", "blue", "yellow"];
number_list = list([1,2,3,4]);
#print(type(number_list));
range_list = list(range(1,100));
#print(range_list);
## GET ALL METHODS
#print(dir(colors));
#print(len(colors));
#print(colors[1]);
#print('red' in colors); True || False
## ADD ITEMS
colors.append('purple');
colors.extend(['cyan','magent']);
colors.extend(['pink','black']);
colors.insert(len(colors),'violet');
print(colors)
##REMOVE ITEMS
#colors.pop(0);
#colors.remove('pink');
#colors.clear()
print(colors)
## SORTING ITEMS
colors.sort()
#colors.sort(reverse=True)
## GETTING INDEX
#print(colors.index('red'));
## COUNTING ITEM
print(colors.count('red'))