How does the function insert work with an argument involving matrices? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How does the function insert work with an argument involving matrices?

For example: x = [ [1,2,3], [4,5,6] ] x.insert ([0][1],7) should insert 7 in place of the 2. Whats the correct syntax for this command?

21st Mar 2022, 2:39 AM
iic3y
iic3y - avatar
2 Answers
+ 3
iicey insert function will insert new item on a particular index, it will not replace already exist value. to replace do this: x[0][1] = 7
21st Mar 2022, 2:51 AM
A͢J
A͢J - avatar
+ 1
Awesome! Thank you
21st Mar 2022, 4:33 AM
iic3y
iic3y - avatar