-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrays.py
More file actions
39 lines (25 loc) · 981 Bytes
/
arrays.py
File metadata and controls
39 lines (25 loc) · 981 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
# ---------ARRAYS-----------------------------
cars = ["Ford", "Volvo", "BMW"]
i=0
length = len(cars)
print("Cars array length..", length)
while length > 0 :
print("Car ARRAys displaying using with While loop------->>",cars[i])
i = i+1
length = length - 1
cars.append("TATA")
for x in cars :
print("Car ARRAYs displaying using with For loop after Adds an element at the end of the list------->>",x)
cars.pop(2)
for x in cars :
print("Car ARRAYs displaying using with For loop after Removes the element at the specified position------->>",x)
cars.insert(1,"Maruti")
cars.insert(3,"Nissan")
for x in cars :
print("Car ARRAYs displaying using with Adds an element at the specified position------->>",x)
cars.sort()
for x in cars :
print("Car ARRAYs displaying using with For loop ===SORT====------->>",x)
cars.reverse()
for x in cars :
print("Car ARRAYs displaying using with For loop ==REVERSE===------->>",x)