# File: randFileW.py # Make n random integers between 1 and 100 # in a file called "myints.txt" import random # imports the random library def main(): filename = input("Name the file you want to create?") many = int(input("How many ints you want? ")) f = open("Texts/" + filename, 'w') # opens a file stream object for writing for i in range(many): # creates many rand ints between 0-100 (not 100) n = random.randint(1,100) f.write(str(n) + '\n') # convert number into string f.close() # close file stream object print("Check file" + filename) main()