Question: Write Python code for this problem The Python random module has functions that can be used to generate random numbers For example the randint function

Write Python code for this problem
The Python random module has functions that can be used to generate random numbers For example the randint function can be used to generate random integers within a specified range, e.g. 1 import random 2 a_randint random.randint (1, 10) 3 print (a_randint) = will generate a random integer, a_randint, within the range [1,10]. If you run the code repeat- edly, using a for loop, you can generate as many numbers as you want. Your task is to, a) Use randint to generate a list of 100 random integers between 1 and 10. b) Write the integers to a text file. c) Open the file, read the integers into an array (i.e. a list). d) Print the average of the integers. Note: use intrinsic functions to compute the average. Hint: what is the definition of average?
Step by Step Solution
3.44 Rating (151 Votes )
There are 3 Steps involved in it
import random file opennumberstxtw for x in range100 n randomrandint110 filewritestrn fileclose f... View full answer
Get step-by-step solutions from verified subject matter experts
