Ive been trying and it won't work, can someone help?
Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 100. The application should let the user specify the file name and how many random numbers the file will hold. When I try to execute the code an error keeps popping up, Ive tried changing it several times and it won't work.. My code: import random afile = open("randomNumbers.txt", "w" ) for i in range(int(input("How many random numbers?: "))): line = str(random.randint(1, 100)) afile.write(line) print(line) afile.read() print("Enter the name of the file to which results should be written:", str(afile)) print("Enter the number of random numbers to be written to the file: ", line) print(afile.open()) afile.close()