Q32Comprehension4 Marks11 Dec 2022
Passage
Based on the above data, answer the given subquestions.
nums is a list of integers in which each element lies in the range 1 to 10, endpoints inclusive. A sample list of size 20 could look like this:
L = [2, 1, 3, 5, 1, 4, 9, 5, 9, 4, 1, 3, 5, 6, 4, 7, 10, 1, 7, 5]
The actual list nums has size n.
We wish to find the frequency of occurrence of each of the numbers in the range 1 to 10, endpoints inclusive, in the list nums. If P is a dictionary that stores this information, which of the following snippets of code is/are an appropriate choice?