-
Notifications
You must be signed in to change notification settings - Fork 1
/
20_list.py
44 lines (42 loc) · 889 Bytes
/
20_list.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
# list1 = [1, True, 1.8, 'S']
# list2 = [2, 'Hello']
# list1.append('Python')
# list1.insert(1, 'Program')
# list1.extend(list2)
# print(list1)
# list1.clear()
# print(list1)
#
# # if 'Python' in list1:
# # list1.remove('Python')
# # list1.pop(2)
# # print(list1)
# # del list1
# # print(list1)
#
# # print(list1)
# # ordered
# # change
# # allow duplicate elements
# # print(list1[2])
# # print(list1[-1])
# # print(list1[:2])
# # print(list1[1:3])
# # print(list1[-2:-4]) # 1, True
# # print(len(list1[3]))
# # a[]
list1 = [1, 2, 10, 5, 8]
# list2 = [6, 7, 8]
# for index, val in enumerate(list1):
# print("{} : {}".format(index, val))
# for i, j in zip(list1, list2):
# print(i, j)
# list1.sort(reverse=False)
# print(list1)
list_a = [1, 2, 5, 1]
# list_b = list_a
# list_a[0] = 100
# print(list_b)
# print(list_a.count(21))
# print(list_a.index('1'))
# if '1' in list_a: