Question: The following function creates a random number from 1 to 1000 (inclusive): import random def getRandom(): val = int(random.random() * 1000) + 1 return val

The following function creates a random number from 1 to 1000 (inclusive): import random def getRandom(): val = int(random.random() * 1000) + 1 return val a. Create a module with this single function (including the import statement) in a file called GetRandom.py b. Create a program that does the following: i. Generate two sets of 100 unique elements, each a random integer between 1 and 1000 inclusive. You must demonstrate the use of the getRandom() function by importing the module GetRandom into this program. ii. Display the number of elements that are the same in both sets. (You must use set operators or methods as part of your solution to this problem.) Do NOT display the elements themselves in your final solution - just the number that are the same. iii. Call this program RandomSetAnalysis.py

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 Programming Questions!