Question: Question: Write a python function occurrences, without any argument. This function should: a) Prints the message: Type an integer value or q to finish, and
Question:
Write a python function occurrences, without any argument. This function should:
a) Prints the message: Type an integer value or q to finish, and press Enter: and stores the typed integers in a list (a variable local to the function) named data, until the user types the letter q to end the input messages.
b) Prints two lists:
1) The list of all integers between the minimum and maximum value in data, inclusive.
2) The list of occurrences of each value in data, i.e., the number of times each value was entered.
Here is an example of run: Type an integer value or q to finish, and press Enter: 0 Type an integer value or q to finish, and press Enter: 3 Type an integer value or q to finish, and press Enter: 5 Type an integer value or q to finish, and press Enter: 7 Type an integer value or q to finish, and press Enter: 3 Type an integer value or q to finish, and press Enter: 7 Type an integer value or q to finish, and press Enter: 3 Type an integer value or q to finish, and press Enter: 4 Type an integer value or q to finish, and press Enter: q [0, 1, 2, 3, 4, 5, 6, 7] [1, 0, 0, 3, 1, 1, 0, 2] The user typed 0 once, never typed 1 or 2, typed 3 three times, 4 once, 5 once, never typed 6 and typed 7 twice.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
