# File: Erin/randFile.py # Make 5 random integers between 1 and 100 (including 1 and 100) # 66 # 28 # 35 # 29 # 74 import random # imports the random library def main(): f = open("integers.txt", 'w') # opens a file stream object for writing for i in range(5): # creates 5 random numbers between 0-100(not 100) number = random.randint(1,100) f.write(str(number) +'\n') # convert number to string then write to a file f = open("integers.txt", 'r') # reopens the file stream object for reading s = f.read() # reads the file and stores it as variable s (string) print(s) # prints the content of the file as a string f.close() # close file stream object main()