Accessing Elements of a List in Python

  Рет қаралды 28,217

Neso Academy

Neso Academy

Күн бұрын

Python Programming: Accessing Elements of a List in Python
Topics discussed:
1. Accessing Elements of a Single-dimensional List.
2. Negative Indexing in a List.
3. Accessing Elements of a Multi-dimensional List.
Python Programming Playlist: • Python Programming
Follow Neso Academy on Instagram: @nesoacademy (bit.ly/2XP63OE)
Contribute: www.nesoacademy.org/donate
Memberships: bit.ly/2U7YSPI
Books: www.nesoacademy.org/recommend...
Website ► www.nesoacademy.org/
Forum ► forum.nesoacademy.org/
Facebook ► goo.gl/Nt0PmB
Twitter ► / nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
#PythonByNeso #PythonProgramming #ListsInPython

Пікірлер: 133
@hariprashant5873
@hariprashant5873 6 ай бұрын
my_list = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]] print(my_list[1][0][1])
@Alooandjuicytomatoes.comhiho
@Alooandjuicytomatoes.comhiho 8 күн бұрын
Hi
@Alooandjuicytomatoes.comhiho
@Alooandjuicytomatoes.comhiho 8 күн бұрын
Hi
@pardhumannem3638
@pardhumannem3638 9 ай бұрын
print(my_list3[1][0][1]) Output:- b
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
syntax error my_list2 is undefined
@PunawaPaschim-bn2fx
@PunawaPaschim-bn2fx 5 ай бұрын
Your answer is right
@jingersatuh6322
@jingersatuh6322 4 ай бұрын
This is a very difficult topic. The presentation was so good that I understood it so easily.
@jeremyserbee3720
@jeremyserbee3720 Ай бұрын
these videos rock. thank you !
@ahmeduddin222
@ahmeduddin222 6 ай бұрын
great, i was having issue in understanding Lists. You explained it very well. Thanks
@jereddymanojkumar3830
@jereddymanojkumar3830 11 ай бұрын
My_list3[1][0][1]='b'
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
syntax error My_list3 is undefined, in python My_list3 != my_list3
@syedyousufdanishmahi3881
@syedyousufdanishmahi3881 4 ай бұрын
😂😂lol@@lionelfaith3646 , good observation
@lefishe7431
@lefishe7431 6 күн бұрын
​@@lionelfaith3646bro
@RahulSingh-qs9ed
@RahulSingh-qs9ed 3 ай бұрын
li1 = [[1,2,3],[['a','b','c'],[5,6]]] print(li1[1][0][1])
@djrkm9281
@djrkm9281 4 ай бұрын
how do I access an individual char from a multi-dimensional list? so if I want to access the N in Neso? is my_list [1] [1] ?
@TheDataMagic_x
@TheDataMagic_x 20 күн бұрын
l1=[[1,2,3],['A','B','C'],5,6] print(l1[1][1]) we can use this type
@yadavstuntboy..6490
@yadavstuntboy..6490 3 ай бұрын
16:40 my_list3 = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]] for accessing 'b' item from my_list3 print(my_list3[1][0][1])
@tonystark33748
@tonystark33748 5 ай бұрын
# Homework-Problem # Q -> Access value "b"? # Code: my_list3 = [[1, 2, 3], ['a', 'b', 'c'], [5, 6]] value_b = my_list3[1][1] print(value_b)
@danielquarshie5235
@danielquarshie5235 6 ай бұрын
The answer is: my_list2[1][0][1]
@tayyab.sheikh
@tayyab.sheikh 12 күн бұрын
I have a question Jaspreet Sir! Why list's index starts from 0 and not 1?
@faithndema
@faithndema 12 күн бұрын
Python indexing is set to start at 0 by default.
@shaiksameer204
@shaiksameer204 17 күн бұрын
my_list=[[1,2,3],"abc",[4,5,6]] print(my_list[1][1]) Output b
@mohammedhamad1513
@mohammedhamad1513 Ай бұрын
my_list3=[1][0][1] the output is b
@RosesAreAlsoPink
@RosesAreAlsoPink 6 ай бұрын
Answer to the Homework Question: print(my_list3[1][1])
@arjunyakala6851
@arjunyakala6851 5 ай бұрын
Wrong...print (my_list3 [1][0][1])
@samaira6031
@samaira6031 5 ай бұрын
The above answer is correct according to the explanation given in the video, although why did we add [0] in between?
@Engineer508
@Engineer508 4 ай бұрын
​@@samaira6031to access first list of second list
@user-xn2es9im9l
@user-xn2es9im9l 4 ай бұрын
List =[[1,2,3],[['a','b'],[5,6]]] Print(list[1][0][1])
@tayyab.sheikh
@tayyab.sheikh 12 күн бұрын
I was here to comment the correct answer but already everyone has posted it.
@baguidybachmar586
@baguidybachmar586 8 ай бұрын
Mylist_3 [1] [1]
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
it's false m your output will be: [5]. remember in python index starts at 0 and it's my_list3 not My_list3
@Raja-tt4ll
@Raja-tt4ll Ай бұрын
Nice
@priyamondal6820
@priyamondal6820 Ай бұрын
list3 = [[1,2,3],['a','b','c'], [5,6]] print (list3 [1][1])
@priyamondal6820
@priyamondal6820 Ай бұрын
or list4 = [[1, 2, 3], ['a', 'b', 'c'], 5, 6] print (list4 [1][1])
@KusumLata-iu6xd
@KusumLata-iu6xd 4 ай бұрын
print(my_list3[1][0][1]) giving error of indexError: string index out of range. the correct answer is [1][1]
@desixhorra
@desixhorra 3 ай бұрын
answer is[1][0][1]
@nithishm6619
@nithishm6619 5 ай бұрын
my_list3[1][0][1] = 'b'
@zeeshanyounas855
@zeeshanyounas855 2 ай бұрын
my_list=[[1,2,3],['a','b','c'],[3,4,5]] print(my_list[1][1])
@sunilkunkekar7383
@sunilkunkekar7383 2 ай бұрын
my_list =[[1,2,3],['a','b','c'],5,6] k= my_list[1][1] print(k)
@malikcomputer2925
@malikcomputer2925 3 ай бұрын
my_list = [1,2,3],['a','b','c'], [5,6] print(my_list[1][1])
@thakuranujbhati1565
@thakuranujbhati1565 2 ай бұрын
Answer of HW -- print(my_list3[1][0][-2])😅Sorry for taking negative indexing only i like that
@atnafunega2206
@atnafunega2206 2 ай бұрын
my_list3 = [[1,2,3],[["a","b","c"],5,6]] print(my_list3[1][0][1])
@frames__time
@frames__time 8 ай бұрын
print(my_list[1][0][1])
@user-xc7uz5xg9y
@user-xc7uz5xg9y 4 ай бұрын
print(my_list3[1][0][1])
@mdazimuddin232
@mdazimuddin232 2 ай бұрын
my_list3=[[1,2,3],[['a','b','c'],5,6]] print(my_list3[1][0][1]) output # b
@ECEKOTESWARARAOM
@ECEKOTESWARARAOM 11 ай бұрын
@Mareamhager
@Mareamhager 4 ай бұрын
my_list = [[1,2,3],[["a","b","c"]'5'6]] Print (my_list[1][0][1])
@brindham4073
@brindham4073 9 ай бұрын
print(my_list[1][1])
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
syntax error my_list is undefined, even if it was my_list3[1][1]=5 not 'b'
@Harbingersknight21
@Harbingersknight21 3 ай бұрын
Answer to homework question : print(my_list3[1][0][1])
@tylerfarless1139
@tylerfarless1139 2 ай бұрын
Answer : my_list3[1][0][1]
@jagsank1k2
@jagsank1k2 2 ай бұрын
print(my_list3[1][1])
@adinarayananaragani9977
@adinarayananaragani9977 3 ай бұрын
Print(my_list[2])
@dheerajnarote8344
@dheerajnarote8344 Ай бұрын
my_list = [[1,2,3], [['a','b','c'], 5,6]] print(my_list[1][0][1]) ans:- b ;)
@wordslink2623
@wordslink2623 11 ай бұрын
My_list 3[2]
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
syntax error because my_list3 has only 2 elements within it, it means the index of a last element is [1].
@shoxjaxonnurxonov2984
@shoxjaxonnurxonov2984 4 ай бұрын
my_list3 = [[1,2,3],[['a','b','c'],5,6]] list3 = my_list3[1][0][1] print(list3) thank you for support, good luck
@tajgill7720
@tajgill7720 4 ай бұрын
print(my_list3[1][1]) homework b
@hemlatamukati2303
@hemlatamukati2303 4 ай бұрын
b = [["a","b","c"],5,6]
@rita_martha
@rita_martha Ай бұрын
my_list3[1][0][1]=b
@rasmusa9212
@rasmusa9212 11 ай бұрын
mylist3[1][1]
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
your output : 5. wrong answer and it's my_list3 not mylist3 (mylist3 is undefined)
@user-en9tz8np8o
@user-en9tz8np8o 4 ай бұрын
My_list[1][0][1]
@tharunkumar8430
@tharunkumar8430 6 ай бұрын
my_list [1] [0] [1]
@user-en9tz8np8o
@user-en9tz8np8o 4 ай бұрын
My list3[1][0]
@user-en9tz8np8o
@user-en9tz8np8o 4 ай бұрын
My list3[1][0][1]
@ketoki69
@ketoki69 11 ай бұрын
[1][1]
@kishaniglesias
@kishaniglesias 5 ай бұрын
my_list3 [1][1]
@lmsphantom5615
@lmsphantom5615 5 ай бұрын
wrong, you need to access the 1st mem block and then0th index of the sub-mem block and then 1st index of the sub-memblock, it would be something like this: my_list3[1][0][1]
@kaushikshiva7852
@kaushikshiva7852 3 ай бұрын
lists=[[1,2,3],["a","b","c",5,6]] print (lists[1][1])
@captaintariq6350
@captaintariq6350 3 ай бұрын
my_list = [[1, 2, 3], ['a', 'b', 'c'], [5, 6]] print(my_list[1][1]) print(my_list[-2][-2]) print(my_list[1][-2]) print(my_list[-2][1])
@cybershrajal
@cybershrajal 2 ай бұрын
Sure, I can explain it simply! First, let's break down the code: mylist = [[1, 2, 3], [5, 6, ['a', 'b', 'c']]] This line creates a list called `mylist` containing two lists inside it. Each of these inner lists contains numbers and another list. Now, let's break down the indexing part: print(mylist[1][2][1]) - `mylist[1]` refers to the second element of `mylist`, which is `[5, 6, ['a', 'b', 'c']]`. - Then, `mylist[1][2]` refers to the third element of that second list, which is `['a', 'b', 'c']`. - Finally, `mylist[1][2][1]` refers to the second element of that inner list, which is `'b'`. So, `print(mylist[1][2][1])` will output `'b'`
@deekshasvikatta7673
@deekshasvikatta7673 11 ай бұрын
my_list3 [1] [0] [1]='b'
@lionelfaith3646
@lionelfaith3646 8 ай бұрын
good job
@RonarRasin-on7nk
@RonarRasin-on7nk 5 ай бұрын
my_list3 = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]] print(my_list3[1][0][1])
@user-hr1fj2dh6j
@user-hr1fj2dh6j Ай бұрын
my_list = [[1, 2, 3], [['a', 'b', 'c'], [5, 6]]] print(my_list[1][0][1])
@ganasindu616
@ganasindu616 8 ай бұрын
@amnaiqbal8016
@amnaiqbal8016 6 ай бұрын
my_list3[1][0][1]=b
@techfriend1144
@techfriend1144 Ай бұрын
my_list = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]] print(my_list[1][0][1])
Adding Elements to a List in Python
14:57
Neso Academy
Рет қаралды 22 М.
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 88 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 44 МЛН
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 27 МЛН
Dynamic Programming I: Introduction
5:24
Sweet Codey
Рет қаралды 24
Input a List using Loops in Python
10:24
Neso Academy
Рет қаралды 29 М.
input() Method in Python
9:21
Neso Academy
Рет қаралды 17 М.
#5 Python Tutorial for Beginners | List in Python
10:42
Telusko
Рет қаралды 2,9 МЛН
for Loop with Lists in Python
8:35
Neso Academy
Рет қаралды 16 М.
Accessing Dictionary Items in Python
9:10
Neso Academy
Рет қаралды 12 М.
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 88 МЛН