Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that imports the Python random module to generate random integers in the range of 1 through 1000 using the following assignment: currentNumber
Write a program that imports the Python random module to generate random integers in the range of 1 through 1000 using the following assignment: currentNumber = random.randint (1,1000) The program should include this statement in a loop to select up 100 of these random numbers. As part of this program, you also need to write and use an isEven function to help you count how many of those numbers were even and how many were odd. The isEven function should be defined to accept a single integer number and return True if the number is even, False if odd. Make sure the user has the option of repeated execution by including an outer loop. This program should produce output similar to the following: >>> \%Run Test1_Program.py Out of 100 random numbers, 51 were odd, and 49 were even. Would you like to run the program again (Y/N):y Out of 100 random numbers, 50 were odd, and 50 were even. Would you like to run the program again (Y/N):y Out of 100 random numbers, 52 were odd, and 48 were even. Would you like to run the program again (Y/N):y Out of 100 random numbers, 53 were odd, and 47 were even. Would you like to run the program again (Y/N):n
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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