Question: In python, Define a function called q1 that takes one input n, assumed to be a positive integer. Your function should import the random module

In python,

Define a function called q1 that takes one input n, assumed to be a positive integer. Your function should import the random module and generate n random integers between 1 and 10. Then your function should create a dictionary where the keys of the dictionary are the strings 1 - 3, 4 - 6, 7 - 10 and the values associated with each key are how many times a number in that range was generated. So for instance, if you generated 4 ones, 7 twos, and 6 threes, the value for 1 - 3 should be 17. Your function should return the dictionary. Nothing needs to be printed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!