- 4
What would be the result of this code if not 6? nums=[9,8,7,6,5] nums.append(4) nums.insert(2,11) Print(len(nums))
8 ответов
+ 4
nums.append(4) addes a 4 to the end of your list whereas nums.insert(2, 11) adds 11 to the place that is the second item in the list. So it'd be [9,8,11,7,6,5,4]
The answer is 7 because there are now 7 items in the list.
+ 3
7 of course. Both, append() and insert(), add a member to the array, not replace an existing one.
+ 2
7
+ 1
The answer is 7 because there are now 7 items in the list.
0
What is the result of this code?
nums = [9, 8, 7, 6, 5]
nums.append(4)
nums.insert(2, 11)
print(len(nums))
7 is the right answer
0
7
0
7
0
7