Fill in the blank issue | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Fill in the blank issue

Fill in the blanks to create a list, reassign its 2nd element and print the whole list. nums = [33, 42, 56_ nums[_] = 22 print(____) Ans: nums = [33, 42, 56] nums[1] = 22 print(nums) So my doubt is why nums[1] is 1?

15th Sep 2020, 7:45 AM
Abhi
Abhi - avatar
1 Answer
+ 2
The question says, "reassign its 2nd element". That's what the second line does. In Python the index is counted from 0, so the second element is nums[1].
15th Sep 2020, 8:10 AM
你知道規則,我也是
你知道規則,我也是 - avatar