A) Competent from Novice:
Which one of the following is the result of 2 * [0, 1, 2, 3, 4, 5]?
- [0, 2, 4, 6, 8, 10]
- [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]
- [[0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]
- TypeError: unsupported operand type(s) for *: ‘int’ and ‘list’
B) Expert from Competent:
Suppose we type the following into our Python prompt:
L = [ [1,2] ]*2
L
[ [1,2], [1,2] ]
L += [ [1, 2] ]
L
[ [1,2], [1,2], [1,2] ]
Which one of the following is correct?
- “L[0] is L[1]” evaluates to False
- “L[0] is L[2]” evaluates to False
- Both of the above
- None of the above