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'`
print(my_list3[1][0][1])
Output:- b
syntax error my_list2 is undefined
Your answer is right
The only correct answer is my_list3[1][1]
This is a very difficult topic. The presentation was so good that I understood it so easily.
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]
Question: mylist_3 = [[1,2,3],[["a","b","c"],5,6]]
Requird Element = b
Solution = mylist_3[1][0][1]
Output : b
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])
l=[[1,2,3],['a','b','c',5,6]]
b=l[1][1]
print(b)
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
How are individual characters of strings stored in the memory inside a multidimensional list? Are the individual characters assigned indices?
These videos are helping me a lot, thank you so much :)
multilist = [[1,2,3],[['a','b','c'],[5,6]]]
print(multilist[1][0][1])
my_list3=[1][0][1] the output is b
these videos rock. thank you !
my_list =[[1,2,3],['a','b','c'],5,6]
k= my_list[1][1]
print(k)
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
a=[[1,2,3],[['a','b','c',[5,6]]]]
print(a[1][0][1])
# to extract the value "b" call:
my_list3[1][0][1]
#output = "b"
My list [[1,2,3],[['a','b','c'],[5,6]]]
Print(my list)[1][0][1]
The answer of the homework problem is my_list3[1][1]
The answer is:
my_list2[1][0][1]
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] ?
the_list = [1,'Neso',2]
print(the_list[1][0])
my_list_3 = [1, 2, 3], "a", "b", "c", [5, 6]
print(my_list_3[2])
my_list3 =[[1,2,3], ["a","b","c"] , 5,6]
print(my_list3[1] [1])
my_list=[[1,2,3],"abc",[4,5,6]]
print(my_list[1][1])
Output
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)
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_list3 = [[1,2,3],[['a','b','c'],5,6]]
#how to access the value 'b' in the above list
print("Accessed element below: ")
print(my_list3[1][0][1])
sir please sir slotion increct negative
my_list3=[[1,2,3],[['a','b','c'],5,6]]
print(my_list3[1][0][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,2,3],[['a','b','c'],5,6]]
list3 = my_list3[1][0][1]
print(list3)
thank you for support, good luck
Print(list_1[1][1])
Out of range if i include [0]
my_list = [[1,2,3],[["a","b","c"]'5'6]]
Print (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])
Answer of HW -- print(my_list3[1][0][-2])😅Sorry for taking negative indexing only i like that
my_list3 = [[1,2,3],[['a','b','c'],5,6]]
The correct answer is;
my_list3 = [ [1, 2, 3], ["a", "b", "c"], [5, 6] ]
print( my_list3 [1] [1])
lists=[[1,2,3],["a","b","c",5,6]]
print (lists[1][1])
Answer to homework question :
print(my_list3[1][0][1])
I was here to comment the correct answer but already everyone has posted it.
Answer : my_list3[1][0][1]
my_list = [[1,2,3], [['a','b','c'], 5,6]]
print(my_list[1][0][1])
ans:- b ;)
l1=[[1,2,3],['A','B','C'],5,6]
print(l1[1][1])
we can use this type
Print(my_list[2])
b = [["a","b","c"],5,6]
print(my_list3[1][1])
print(my_list[1][1])
syntax error my_list is undefined, even if it was my_list3[1][1]=5 not 'b'
print(my_list[1][0][1])
print(my_list3[1][0][1])
list3[2]
my_list3 [1] [0] [1]='b'
good job
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].
print(my_list3[1][1]) homework b
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
Wrong
mylist3[1][1]
your output : 5. wrong answer and it's my_list3 not mylist3 (mylist3 is undefined)
my_list3[1][0][1]=b
Nice
List =[[1,2,3],[['a','b'],[5,6]]]
Print(list[1][0][1])
My_list[1][0][1]
list_1 = [[1,2,3],[['a','b','c'],4,5,6]]
list_1
list_1[1][0][1]
My-list3,[1][0]=0
my_list = [1,2,3],['a','b','c'], [5,6]
print(my_list[1][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]
My list3[1][0]
my_list [1] [0] [1]
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'`
When you type [1] [2] youll get 6. So you must type [1][0]
my_list3 = [[1, 2, 3], [['a', 'b', 'c'], 5, 6]]
print(my_list3[1][0][1])
[1][1]
❤
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])
my_list = [[1, 2, 3], [['a', 'b', 'c'], [5, 6]]]
print(my_list[1][0][1])
numbers = [[1,2,3],[['a','b','c'],5,6]]
print(numbers[1][0][1])
my_list3 = [[1,2,3], ['a','b','c'], [5,6]]
print(my_list3[1][1])
my_list3 = [[1,2,3],[["a","b","c"],5,6]]
print(my_list3[1][0][1])
my_list=[[1,2,3],['a','b','c'],[3,4,5]]
print(my_list[1][1])
print(my_list[1][1])
my_list3[1][0][1] = 'b'
my_list3[1][0][1]=b
print(my_list3[1][1])
My_list[1][0][1]
my_list3=[[1,2,3],[['a','b','c'],5,6]]
print(my_list3[1][0][1])
print(my_list3[1][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,2,3],[["a","b","c"],5,6]]
print(my_list3[1][0][1])
my_list = [1,2,3,[['a','b','c'],5,6]]
print(my_list[3][0][1])
my_list =[1,2,3,],[['a', 'b', 'c'], 5, 6]
print(my_list[1][0][1])