Python Lists
Python Lists
mylist = [25, 50, 75, 100, 125, 150, 175, 200 ];
mylist = ["Nathan", "Darren", "Blair", "Bryce", "Stacey" ];
mylist = [5.7, 8.2, 9. 3.8, 2.9]
mylist = ["Blair", 10, 5.8, 8.9, "Nathan"]
https://studyopedia.com/python3/python-lists/ 3/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
#Creating List1
mylist1 = ["Blair", 10, 5.8, 8.9, "Nathan"]
print(mylist1)
#Creating List2
mylist2 = [5.7, 8.2, 3.8, 2.9]
print(mylist2)
#Creating List3
mylist3 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
print(mylist3)
['Blair', 10, 5.8, 8.9, 'Nathan']
[5.7, 8.2, 3.8, 2.9]
[3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
print(mylist[2])
#Creating List1
mylist1 ["Blair" 10 5 8 8 9 "Nathan"]
https://studyopedia.com/python3/python-lists/ 4/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
mylist1 = [ Blair , 10, 5.8, 8.9, Nathan ]
print("List1 = ",mylist1)
print("List1 element at position 3rd = ",mylist1[2])
#Creating List2
mylist2 = [5.7, 8.2, 3.8, 2.9]
print("List2 = ",mylist2)
print("List2 element at position 4th = ",mylist2[3])
#Creating List3
mylist3 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
print("List3 = ",mylist3)
print("List3 element at position 7th = ",mylist3[6])
List1 = ['Blair', 10, 5.8, 8.9, 'Nathan']
List1 element at position 3rd = 5.8
List2 = [5.7, 8.2, 3.8, 2.9]
List2 element at position 4th = 2.9
List3 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
List3 element at position 7th = 12
mylist[2] = 50;
Above, we updated the 3rd position (index x2) with the value 50 using slice and assignment operator.
Next, let us now see an example wherein we will be updating three different lists in a single Python
program:
https://studyopedia.com/python3/python-lists/ 5/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
#Updating element from 3 Lists
#Creating List1
mylist1 = ["Blair", 10, 5.8, 8.9, "Nathan"]
print("List1 = ",mylist1)
print("List1 element at position 3rd = ",mylist1[2])
#updating mylist1
mylist1[2] = 7.2;
print("Updated List1 = ",mylist1)
print("Updated List1 element at position 3rd = ",mylist1[2])
print("--------------------------")
#Creating List2
mylist2 = [5.7, 8.2, 3.8, 2.9]
print("List2 = ",mylist2)
print("List2 element at position 4th = ",mylist2[3])
#updating mylist2
mylist2[3] = 8.6;
print("Updated List2 = ",mylist2)
print("Updated List2 element at position 4th = ",mylist2[3])
print("--------------------------")
#Creating List3
mylist3 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
print("List3 = ",mylist3)
print("List3 element at position 7th = ",mylist3[6])
#updating List3
mylist3[6] = 25;
print("Updated List3 = ",mylist3)
print("Updated List3 element at position 7th = ",mylist3[6])
List1 = ['Blair', 10, 5.8, 8.9, 'Nathan']
List1 element at position 3rd = 5.8
Updated List1 = ['Blair', 10, 7.2, 8.9, 'Nathan']
Updated List1 element at position 3rd = 7.2
https://studyopedia.com/python3/python-lists/ 6/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
--------------------------
List2 = [5.7, 8.2, 3.8, 2.9]
List2 element at position 4th = 2.9
Updated List2 = [5.7, 8.2, 3.8, 8.6]
Updated List2 element at position 4th = 8.6
--------------------------
List3 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
List3 element at position 7th = 12
Updated List3 = [3, 1, 6, 7, 9, 15, 25, 18, 17, 16, 20]
Updated List3 element at position 7th = 25
del mylist(3)
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#deleting an element
del mylist[4]
#updated list
print("Updated List after deleting an element = ",mylist)
#deleting another element
del mylist[1]
#final list
print("Updated List after deleting another element = ",mylist)
https://studyopedia.com/python3/python-lists/ 7/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
Updated List after deleting an element = ['Squash', 'Football', 'Hockey', 'Cricket']
Updated List after deleting another element = ['Squash', 'Hockey', 'Cricket']
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#deleting an element
del mylist[2]
#updated list
print("Updated List after deleting an element = ",mylist)
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
Updated List after deleting an element = ['Squash', 'Football', 'Cricket', 'Archery']
#Creating List
mylist ["Squash" "Football" "Hockey" "Cricket" "Archery"]
https://studyopedia.com/python3/python-lists/ 8/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
mylist = [ Squash , Football , Hockey , Cricket , Archery ]
print("List = ",mylist)
#deleting an element
mylist.remove("Hockey")
#updated list
print("Updated List after deleting an element = ",mylist)
#deleting another element
mylist.remove("Archery")
#updated final list
print("Updated List after deleting another element = ",mylist)
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
Updated List after deleting an element = ['Squash', 'Football', 'Cricket', 'Archery']
Updated List after deleting another element = ['Squash', 'Football', 'Cricket']
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#delete entire List
del mylist
#error (mylist not defined) since the List is now deleted
print(mylist)
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
Traceback (most recent call last):
File "./prog.py", line 9, in <module>
NameError: name 'mylist' is not defined
Above, we are getting an error since we are trying to display the List which we deleted using the del
keyword.
del mylist[2:4]
Above, we deleted elements from 2 (including) to 4 (excluding) index. Therefore, we deleted two elements
i.e. index 2 and index 3.
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#delete multiple elements
del mylist[2:4]
#Updated List
print("Update List after deleting multiple items = ",mylist)
https://studyopedia.com/python3/python-lists/ 10/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
Update List after deleting multiple items = ['Squash', 'Football', 'Archery']
Indexing in Lists
For indexing in Lists, use the index operator []. The indexing in Lists begins from 0. The last item is tuple
length – 1. Set the index in square brackets and fetch a specific element at the same index. With that, if
you want to count from the right, use negative indexing. The slice operator can also be used to fetch a
specific set of sub-elements. This is achieved with the colon operator and allows to fetch multiple items.
Let us see them one by one.
To fetch a specific element, just set index in square bracket i.e. refer the index number:
Fetch a specific element at 1st position: mylist[0]
Fetch a specific element at 2nd position: mylist[1]
Fetch a specific element at 3rd position: mylist[2]
Fetch a specific element at 4th position: mylist[3]
Above, we fetched elements using index number. Let us see an example and fetch a specific element with
indexing in Lists:
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#fetch 1st element
https://studyopedia.com/python3/python-lists/ 11/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
#fetch 1st element
print("1st element = ",mylist[0])
#fetch 2nd element
print("2nd element = ",mylist[1])
#fetch 3rd element
print("3rd element = ",mylist[2])
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
1st element = Squash
2nd element = Football
3rd element = Hockey
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#fetch 1st element
print("1st element = ",mylist[0])
#fetch 2nd element
print("2nd element = ",mylist[1])
#fetch 3rd element
print("3rd element = ",mylist[2])
#negative indexing
print("------------------------")
#fetch last element
print("Last element = ",mylist[-1])
#fetch 2nd last element
print("2nd last element = ",mylist[-2])
https://studyopedia.com/python3/python-lists/ 12/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
p t( d ast e e e t , y st[ ])
#fetch 3rd last element
print("3rd last element = ",mylist[-3])
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
1st element = Squash
2nd element = Football
3rd element = Hockey
------------------------
Last element = Archery
2nd last element = Cricket
3rd last element = Hockey
Slice Lists
Slice Lists in Python using the slice operator (:). The slice operator is used to fetch a specific set of sub-
elements i.e. slicing. Let us see an example:
#Creating List
mylist = ["Squash", "Football", "Hockey", "Cricket", "Archery"]
print("List = ",mylist)
#fetch 1st element
print("1st element = ",mylist[0])
#fetch 2nd element
print("2nd element = ",mylist[1])
#fetch 3rd element
print("3rd element = ",mylist[2])
#slice
print(mylist[2:4])
#elements beginning from 2nd to end
print(mylist[2:])
List = ['Squash', 'Football', 'Hockey', 'Cricket', 'Archery']
1st element = Squash
2nd element = Football
3rd element = Hockey
['Hockey', 'Cricket']
['Hockey', 'Cricket', 'Archery']
In the above example, [2:4] means the search starts from index 2 (including) and ends at index 4
(excluding). In the same way, [2:] means the search starts from 2nd to end.
Range of indexes
By specifying the start and end range, we can specify the range of indexes in Python. Let us see an
example:
print(mylist[1:2])
print(mylist[1:4])
print(mylist[1:5])
print(mylist[3:5])
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
print(mylist[1:2])
print(mylist[1:4])
print(mylist[1:5])
print(mylist[3:5])
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
['Billy']
['Billy', 'Lucas', 'Albert']
['Billy', 'Lucas', 'Albert', 'Eva']
['Albert', 'Eva']
In the above example, [1:2] means the search starts from index 1 (including) and ends at index 2
(excluding). In the same way, [3:5] means the search starts from 2 (including) and ends at index 5
(excluding):
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
#Printing the List
print("Iterating though the List...")
#Iterating through the List
for v in mylist:
print(v)
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
Iterating though the List...
Teun
Billy
Lucas
Albert
https://studyopedia.com/python3/python-lists/ 15/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
Eva
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
#Printing the List
print("Iterating though the List...")
#Iterating through the List
for v in mylist:
print(v)
mylist.append("Sam")
#Printing the updated List
print("Iterating though the updated List...")
#Iterating through the List
for v in mylist:
print(v)
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
Iterating though the List...
Teun
Billy
Lucas
Albert
Eva
Iterating though the updated List...
Teun
Billy
Lucas
Albert
https://studyopedia.com/python3/python-lists/ 16/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
Albert
Eva
Sam
mylist.insert(3, "Brandon")
Above, the first parameter in the insert() method is the index and the second parameter is the element to
be inserted.
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
#Printing the List
print("Iterating though the List...")
#Iterating through the List
for v in mylist:
print(v)
mylist.insert(4,"Brandon")
#Printing the updated List
print("Iterating though the updated List...")
#Iterating through the List
for v in mylist:
print(v)
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
Iterating though the List...
Teun
Billy
Lucas
Albert
Eva
Iterating though the updated List...
Teun
Billy
Lucas
Albert
Brandon
Eva
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
#Iterating through the List
for v in mylist:
print(v)
#checking for element Lucas
if "Lucas" in mylist:
print("Found!")
#checking for element Gary
if "Gary" in mylist:
print("Found!")
https://studyopedia.com/python3/python-lists/ 18/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
Teun
Billy
Lucas
Albert
Eva
Found!
#Creating List
mylist = [10, 20, 30, 40]
print("List = ",mylist)
#Iterating through the List
for v in mylist:
print(v)
#Creating another List
mylist2 = [50, 60, 70]
mylist.extend(mylist2)
#Display the updated List
print("List = ",mylist)
#Iterating through the updated List
for v in mylist:
print(v)
List = [10, 20, 30, 40]
10
20
https://studyopedia.com/python3/python-lists/ 19/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
20
30
40
List = [10, 20, 30, 40, 50, 60, 70]
10
20
30
40
50
60
70
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
#List length
print("Length List = ",len(mylist));
print("Iterating List elements......");
#Iterating through the List
for v in mylist:
print(v)
#checking for element Lucas
if "Lucas" in mylist:
print("Found!")
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
Length List = 5
Iterating List elements......
https://studyopedia.com/python3/python-lists/ 20/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
te at g st e e e ts......
Teun
Billy
Lucas
Albert
Eva
Found!
#Creating List1
mylist1 = [5.7, 8.2, 3.8, 2.9]
print("List1 = ",mylist1)
print("Maximum value in List1 = ",max(mylist1))
#Creating List2
mylist2 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
print("List2 = ",mylist2)
print("Maximum value in List2 = ",max(mylist2))
List1 = [5.7, 8.2, 3.8, 2.9]
Maximum value in List1 = 8.2
List2 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
Maximum value in List2 = 20
#Creating List1
mylist1 = [5.7, 8.2, 3.8, 2.9]
print("List1 " mylist1)
https://studyopedia.com/python3/python-lists/ 21/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
print( List1 = ,mylist1)
print("Maximum value in List1 = ",max(mylist1))
print("Minimum value in List1 = ",min(mylist1))
#Creating List2
mylist2 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
print("List2 = ",mylist2)
print("Maximum value in List2 = ",max(mylist2))
print("Minimum value in List2 = ",min(mylist2))
List1 = [5.7, 8.2, 3.8, 2.9]
Maximum value in List1 = 8.2
Minimum value in List1 = 2.9
List2 = [3, 1, 6, 7, 9, 15, 12, 18, 17, 16, 20]
Maximum value in List2 = 20
Minimum value in List2 = 1
#Creating List1
mylist1 = [5.7, 8.2, 3.8, 2.9]
print("List1 = ",mylist1)
print("Maximum value in List1 = ",max(mylist1))
print("Minimum value in List1 = ",min(mylist1))
#Making a copy
print("Copying List1 to List2......")
mylist2 = mylist1.copy()
print("List2 = ",mylist2)
https://studyopedia.com/python3/python-lists/ 22/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
List1 = [5.7, 8.2, 3.8, 2.9]
Maximum value in List1 = 8.2
Minimum value in List1 = 2.9
Copying List1 to List2......
List2 = [5.7, 8.2, 3.8, 2.9]
#Creating List1
mylist1 = [10, 20, 25, 40, 45]
print("List1 = ",mylist1)
print("Maximum value in List1 = ",max(mylist1))
print("Minimum value in List1 = ",min(mylist1))
print("------------------------------------");
#Creating List1
mylist2 = [70, 80, 95, 120, 150]
i t("Li t2
https://studyopedia.com/python3/python-lists/
" li t2) 23/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
print("List2 = ",mylist2)
print("Maximum value in List2 = ",max(mylist2))
print("Minimum value in List2 = ",min(mylist2))
print("------------------------------------");
#Joining two Lists
mylist3 = mylist1 + mylist2
print("Joining List1 and List2 =",mylist3)
List1 = [10, 20, 25, 40, 45]
Maximum value in List1 = 45
Minimum value in List1 = 10
------------------------------------
List2 = [70, 80, 95, 120, 150]
Maximum value in List2 = 150
Minimum value in List2 = 70
------------------------------------
Joining List1 and List2 = [10, 20, 25, 40, 45, 70, 80, 95, 120, 150]
#Creating List1
mylist1 = [20, 40, 60, 80, 100]
print("List1 = ",mylist1)
print("Maximum value in List1 = ",max(mylist1))
print("Minimum value in List1 = ",min(mylist1))
print("------------------------------------");
#Creating List1
mylist2 = [120, 140, 160, 180, 200]
print("List2 = ",mylist2)
print("Maximum value in List2 = ",max(mylist2))
print("Minimum value in List2 = ",min(mylist2))
https://studyopedia.com/python3/python-lists/ 24/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
print("------------------------------------");
#Concatenating two Lists
mylist3 = mylist1 + mylist2
print("Concatenation Result of List1 and List2 =",mylist3)
List1 = [20, 40, 60, 80, 100]
Maximum value in List1 = 100
Minimum value in List1 = 20
------------------------------------
List2 = [120, 140, 160, 180, 200]
Maximum value in List2 = 200
Minimum value in List2 = 120
------------------------------------
Concatenation Result of List1 and List2 = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200
#Creating List
mylist = ["Teun", "Billy", "Lucas", "Albert", "Eva"]
print("List = ",mylist)
#Printing the List
print("Iterating though the List...")
#Iterating through the List
for v in mylist:
print(v)
#sorting the List
mylist.sort()
print("Sorted List...");
for v in mylist:
print(v)
https://studyopedia.com/python3/python-lists/ 25/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
List = ['Teun', 'Billy', 'Lucas', 'Albert', 'Eva']
Iterating though the List...
Teun
Billy
Lucas
Albert
Eva
Sorted List...
Albert
Billy
Eva
Lucas
Teun
#Creating List
mylist = [10, 20, 25, 40, 45, 60, 80, 90, 100,200]
print("List = ",mylist)
#Reverse List
mylist.reverse()
print("Reverse List = ",mylist);
List = [10, 20, 25, 40, 45, 60, 80, 90, 100, 200]
Reverse List = [200, 100, 90, 80, 60, 45, 40, 25, 20, 10]
https://studyopedia.com/python3/python-lists/ 26/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
mylist = [[10, 20, 35, 40,], [50, 60], [80], [90, 100, 200]]
Above, we created 4 integer lists in a List i.e. Multi-dimensional List. To access a list in a multi-dimensional
list, use square brackets, like Multi-Dimensional Arrays with:
list[row_size][column_size]
We are accessing the first and second element in the 1st list of our Multi-Dimensional List:
print(mylist[0][0])
print(mylist[0][1])
To explain the concept, we have represented Multi-dimensional List graphically below. Similarly, we
represent the left index as row number and right index as column number:
https://studyopedia.com/python3/python-lists/ 27/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
Finally, let us see an example wherein we will be creating a Multi-Dimensional List and learn to display all
the elements or any specific element:
#Creating List mylist1
mylist = [10, 20, 25, 40, 45, 60, 80, 90, 100,200]
print("Printing the entire List1")
#Creating multi-dimensional List mylist2
mylist2 = [[10, 20, 35, 40], [50, 60], [80], [90, 100, 200]]
print("List2 = ",mylist2)
print("Printing elements (row1) from multi-dimensional List2");
print(mylist2[0][0])
print(mylist2[0][1])
print(mylist2[0][2])
print(mylist2[0][3])
print("Printing elements (row2) from multi-dimensional List2");
print(mylist2[1][0])
print(mylist2[1][1])
print("Printing element (row3) from multi-dimensional List2");
print(mylist2[2][0])
print("Printing elements (row4) from multi-dimensional List2");
print(mylist2[3][0])
print(mylist2[3][1])
https://studyopedia.com/python3/python-lists/ 28/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
print(mylist2[3][1])
print(mylist2[3][2])
print("Printing the entire multi-dimensional List2");
for res in mylist2:
print(res)
Printing the entire List1
List2 = [[10, 20, 35, 40], [50, 60], [80], [90, 100, 200]]
Printing elements (row1) from multi-dimensional List2
10
20
35
40
Printing elements (row2) from multi-dimensional List2
50
60
Printing element (row3) from multi-dimensional List2
80
Printing elements (row4) from multi-dimensional List2
90
100
200
Printing the entire multi-dimensional List2
[10, 20, 35, 40]
[50, 60]
[80]
[90, 100, 200]
list[0][0]
https://studyopedia.com/python3/python-lists/ 29/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
list[0][1]
In the same way, for the 1st element in the second row:
list[1][0]
Finally, let us see an example to access elements in a Multi-Dimensional List with 4 lists:
#Creating multi-dimensional List
mylist = [[10], [50, 60], [80], [90, 100, 200]]
print("List = ",mylist)
print("Printing elements (row1) from multi-dimensional List");
print(mylist[0][0])
print("Printing elements (row2) from multi-dimensional List");
print(mylist[1][0])
print(mylist[1][1])
print("Printing element (row3) from multi-dimensional List2");
print(mylist[2][0])
print("Printing elements (row4) from multi-dimensional List2");
print(mylist[3][0])
print(mylist[3][1])
print(mylist[3][2])
print("Printing the entire multi-dimensional List");
for res in mylist:
print(res)
List = [[10], [50, 60], [80], [90, 100, 200]]
Printing elements (row1) from multi-dimensional List
10
Printing elements (row2) from multi-dimensional List
50
60
Printing element (row3) from multi-dimensional List2
80
Printing elements (row4) from multi-dimensional List2
90
100
200
Printing the entire multi-dimensional List
[10]
[50, 60]
[80]
[90, 100, 200]
#Creating multi-dimensional List
mylist = [[10], [50, 60], [80], [90, 100, 200]]
print("List = ",mylist)
print("Printing the multi-dimensional List");
for res in mylist:
print(res)
#Adding elements to the end
mylist.append([250, 275, 350])
print("Printing the updated multi-dimensional List");
for res in mylist:
print(res)
https://studyopedia.com/python3/python-lists/ 31/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
List = [[10], [50, 60], [80], [90, 100, 200]]
Printing the multi-dimensional List
[10]
[50, 60]
[80]
[90, 100, 200]
Printing the updated multi-dimensional List
[10]
[50, 60]
[80]
[90, 100, 200]
[250, 275, 350]
In this tutorial, we learned what are Lists in Python. Moreover, we worked around in creating Python Lists
and its operations like adding, deleting, extending, appending, etc. Clearly, it’s quite easy to work on
Python Lists. Apart from this, if you are aware of a topic we missed in List, then kindly mention in the
comment section.
Recommend Posts
https://studyopedia.com/python3/python-lists/ 32/34
3/5/22, 10:57 AM Python Lists with Examples - Studyopedia
} W
Share Print page 0 Likes
NO COMMENTS
https://studyopedia.com/python3/python-lists/ 33/34