Trace Involving Lists Flashcards

1
Q

What does this output?
nums = [1, 2, 3]
nums.append(4)
nums.pop()
print(nums)

A

[1, 2, 3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens after nums.insert(1, 10) if nums = [1, 2, 3]?

A

The list becomes [1, 10, 2, 3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does nums.remove(2) do if nums = [1, 2, 3]?

A

The list becomes [1, 3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly