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
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started