-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLists.py
130 lines (95 loc) · 3.33 KB
/
Lists.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#................1
#.............Data Types......
#.......Lists......
#......Lists/Arrays.......
#....But we call arrays asa alist in Python Language......
#..............1
my_namesLists=['Samahar','Ozge','Berk','Burak','Hande','Ayca','Furkan','Aybuk','Burak','Burak']
print(my_namesLists)
for i in my_namesLists:
print(i)
#.......Methods of Lists:......
#......method#1.......
#......Append method........
fruits_namesList=['Mangoes','Oranges','Kivi','Grapes','Pineapple']
fruits_namesList.append('Strawberry')
fruits_namesList.append('Apple')
fruits_namesList.append('Bananas')
for i in fruits_namesList:
print(i)
#............method#2......
#.........Clear Method.....
my_subj_namesList=['Math','Computer','English','Urdu','Islamiyat','Economics','Education','Civics']
my_subj_namesList.clear()
for i in my_subj_namesList:
print(i)
#.......Method#3.....
#.......Extend Method..........
my_fav_programminglang_namesLists=['Python','Js','PHP','Java','SQL','Ruby']
my_fav_programminglang_namesLists.extend('C++')
my_fav_programminglang_namesLists.extend('React')
for i in my_fav_programminglang_namesLists:
print(i)
#.........Method4....
#.......Count Method.....
my_namesLists=['Samahar','Ozge','Berk','Burak','Hande','Ayca','Furkan','Aybuk','Burak','Burak']
let_a=my_namesLists.count('Aybuk')
let_a=my_namesLists.count('Burak')
print(let_a)
for i in my_namesLists:
print(i)
#...............Method#5..........
#............insert Method........
my_fav_countries_namesLists=['Turkiye','America','Egypt','Uk','England','Iran','Azerbijan','Austrailia']
my_fav_countries_namesLists.insert(1,'Qatar')
my_fav_countries_namesLists.insert(4,'Iraq')
my_fav_countries_namesLists.insert(6,'Sirilanka')
my_fav_countries_namesLists.insert(7,'Paris')
my_fav_countries_namesLists.insert(3,'Yemen')
for i in my_fav_countries_namesLists:
print(i)
#.......Method#6.......
#........'Reverse Method'........
fruits_namesList=['Mangoes','Oranges','Kivi','Grapes','Pineapple']
fruits_namesList.reverse()
for i in fruits_namesList:
print(i)
#......Method#7........
#......Sort Method.....
my_fav_programminglang_namesLists=['Python','Js','PHP','Java','SQL','Ruby']
my_fav_programminglang_namesLists.sort()
for i in my_fav_programminglang_namesLists:
print(i)
#.........Method#8......
#.........Pop Method....
fruits_namesList=['Mangoes','Oranges','Kivi','Grapes','Pineapple']
let_b=fruits_namesList.pop(4)
let_b=fruits_namesList.pop(2)
print(let_b)
for i in fruits_namesList:
print(i)
#..........Method#9......
#.......remove Method......
my_subj_namesList=['Math','Computer','English','Urdu','Islamiyat','Economics','Education','Civics']
my_subj_namesList.remove('Civics')
my_subj_namesList.remove('Urdu')
my_subj_namesList.remove('Education')
for i in my_subj_namesList:
print(i)
#.......Method#10....
#........Index Method.....
my_namesLists=['Samahar','Ozge','Berk','Burak','Hande','Ayca','Furkan','Aybuk','Burak','Burak']
let_i=my_namesLists.index('Aybuk')
let_i=my_namesLists.index('Furkan')
let_i=my_namesLists.index('Berk')
let_i=my_namesLists.index('Burak')
print(let_i)
for i in my_namesLists:
print(i)
#......Method11...
#.....copy Method....
my_fav_programminglang_namesLists=['Python','Js','PHP','Java','SQL','Ruby']
my_fav_programminglang_namesLists.copy()
for i in my_fav_programminglang_namesLists:
print(i)
#.........Finished!........#