Question 22
The following Python expression is entered into a fresh Python shell with no prior import statements. Determine the result from evaluating the following expression. [3 marks]
Solution
Let's look at the set we are trying to get the length of here:
The elements in the tuple are as follows: (1, 3), (3, 5), (5, 7), 9.
Elements (1, 3), (3, 5) and (5, 7) count as 1 element each, since on the same surface level, these tuples are 1 unit.
In other words, we do not deep dive into each atomic element inside this whole tuple.
This then means that there are 4 elements in total, hence the given expression results as 4.