Taking the list a = [1, 2, [3, 4], 5], after we make a[1:2] = [[2, 3], 4]. Verify your answers in Python Shell.

(a) What is the length of a ?

(a) What is the length of a ?

After executing a[1:2] = [[2, 3], 4] on the list a = [1, 2, [3, 4], 5], the resulting list will be:

a=[1, [2, 3], 4, [3, 4], 5]
(a) The length of a is 5.

(b) How many elements does it contain?

(b) a contains 5 elements.

(c) How many integers ?

(c) a contains 3 integers, which are 1, 4, and 5.

(d) What does len(a[1] + a[3]) return?

(d) a[1] + a[3] will return [2, 3, 3, 4]. The len() function applied to this list will return 4, since it contains 4 elements. Therefore, len(a[1] + a[3]) will return 4.