Correct answer is : my_list3[1][0][1] [1] access the second list in my_list3 Then we see at [1] there are 2more lists,so if we want to access "b" we need to access the first list by [0] And followed by the element we want to access [1]
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]
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'`
my_list = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]]
print(my_list[1][0][1])
print(my_list3[1][0][1])
Output:- b
syntax error my_list2 is undefined
Your answer is right
This is a very difficult topic. The presentation was so good that I understood it so easily.
great, i was having issue in understanding Lists. You explained it very well. Thanks
My_list3[1][0][1]='b'
syntax error My_list3 is undefined, in python My_list3 != my_list3
😂😂lol@@lionelfaith3646 , good observation
@@lionelfaith3646bro
👍👍@@lionelfaith3646
these videos rock. thank you !
li1 = [[1,2,3],[['a','b','c'],[5,6]]]
print(li1[1][0][1])
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])
l1=[[1,2,3],['A','B','C'],5,6]
print(l1[1][1])
we can use this type
my_list3=[[1,2,3],[['a','b','c'],5,6]]
print(my_list3[1][0][1])
Print(list_1[1][1])
Out of range if i include [0]
my_list3 [1] [0] [1]='b'
good job
I have a question Jaspreet Sir! Why list's index starts from 0 and not 1?
Python indexing is set to start at 0 by default.
It is offset from the starting point. The first element is at zero offset from the starting point
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] ?
my_list3=[1][0][1] the output is b
print(my_list3[1][1])
my_list3=[[1,2,3],[['a','b','c'],5,6]]
print(my_list3[1][0][1])
output # b
list3 = [[1,2,3],['a','b','c'], [5,6]]
print (list3 [1][1])
or
list4 = [[1, 2, 3], ['a', 'b', 'c'], 5, 6]
print (list4 [1][1])
Answer : my_list3[1][0][1]
my_list=[[1,2,3],"abc",[4,5,6]]
print(my_list[1][1])
Output
b
Mylist_3 [1] [1]
it's false m your output will be: [5].
remember in python index starts at 0 and it's my_list3 not My_list3
my_list3[1][0][1]=b
The correct answer is;
my_list3 = [ [1, 2, 3], ["a", "b", "c"], [5, 6] ]
print( my_list3 [1] [1])
Correct answer is : my_list3[1][0][1]
[1] access the second list in my_list3
Then we see at [1] there are 2more lists,so if we want to access "b" we need to access the first list by [0]
And followed by the element we want to access [1]
my_list = [[1,2,3], [['a','b','c'], 5,6]]
print(my_list[1][0][1])
ans:- b ;)
my_list =[[1,2,3],['a','b','c'],5,6]
k= my_list[1][1]
print(k)
The answer is:
my_list2[1][0][1]
Nice
my_list = [1,2,3],['a','b','c'], [5,6]
print(my_list[1][1])
my_list=[[1,2,3],['a','b','c'],[3,4,5]]
print(my_list[1][1])
Answer of HW -- print(my_list3[1][0][-2])😅Sorry for taking negative indexing only i like that
print(my_list[1][0][1])
print(my_list3[1][0][1])
my_list3 = [[1,2,3],[['a','b','c'],5,6]]
list3 = my_list3[1][0][1]
print(list3)
thank you for support, good luck
Print(my_list[2])
print(my_list3[1][0][1]) giving error of indexError: string index out of range. the correct answer is [1][1]
answer is[1][0][1]
my_list = [[1,2,3],[["a","b","c"]'5'6]]
Print (my_list[1][0][1])
Answer to homework question :
print(my_list3[1][0][1])
My_list 3[2]
syntax error because my_list3 has only 2 elements within it, it means the index of a last element is [1].
My_list[1][0][1]
Answer to the Homework Question: print(my_list3[1][1])
Wrong...print (my_list3 [1][0][1])
The above answer is correct according to the explanation given in the video, although why did we add [0] in between?
@@samaira6031to access first list of second list
b = [["a","b","c"],5,6]
print(my_list[1][1])
syntax error my_list is undefined, even if it was my_list3[1][1]=5 not 'b'
lists=[[1,2,3],["a","b","c",5,6]]
print (lists[1][1])
print(my_list3[1][1]) homework b
❤
# 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)
I was here to comment the correct answer but already everyone has posted it.
mylist3[1][1]
your output : 5. wrong answer and it's my_list3 not mylist3 (mylist3 is undefined)
My list3[1][0]
My list3[1][0][1]
my_list [1] [0] [1]
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])
my_list3 [1][1]
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]
List =[[1,2,3],[['a','b'],[5,6]]]
Print(list[1][0][1])
[1][1]
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'`
When you type [1] [2] youll get 6. So you must type [1][0]
my_list = [[1, 2, 3], [['a', 'b', 'c'], [5, 6]]]
print(my_list[1][0][1])
my_list3[1][0][1] = 'b'
my_list3 = [[1,2,3],[["a","b","c"],5,6]]
print(my_list3[1][0][1])
my_list3[1][0][1]=b
❤
my_list = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]]
print(my_list[1][0][1])
my_list3 = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]]
print(my_list3[1][0][1])