We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e35cb80 commit 2272632Copy full SHA for 2272632
4 List[].py
@@ -0,0 +1,42 @@
1
+# List[], Tuples(), Set{}
2
+# List = []
3
+names = ['maniraj', 'priya', 'rubi', 'maniraj']
4
+print(names)
5
+
6
+#call particular value in list
7
+print(names[0])
8
9
+#slicing
10
+print(names[0:2])
11
12
+#negative slicing
13
+print(names[-4:-2])
14
+print(names[-4:-1])
15
16
17
+# change or update the list
18
+names[3] = 'subash'
19
20
21
+# methods - append
22
+names.append('nivi')
23
24
25
26
+# methods - sort
27
28
+#ascending
29
+no = [9, 6, 3, 5, 1]
30
+no.sort()
31
+print(no)
32
33
+#decending
34
+no.sort(reverse=True)
35
36
37
+#add two List[]
38
+addition = names + no
39
+print(addition)
40
41
+# length
42
+print(len(names))
0 commit comments