infile.write(line) # # # # # diff blah english3.txt # python3 RandomInput5.py # Creates a random input file for CSE 101 pa5 by randomizing the lines in # RandomInput5.py # file english3.txt, which contains 194,434 different words in alphabetical # order. To run this program, do # ouput from diff indicates there was no difference in the files. # then test your program by doing # where blah was the name of the input file created by this program. No # close files # get file names and open files # read lines of this file into a list and randomize the list # to mix-up some other file put its name in place of 'english3.txt' # write mixed lines to new file #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ L = thisfile.readlines() for line in L: from random import shuffle infile = open(input('Enter name of file to create: '),'w') infile.close() shuffle(L) thisfile = open('english3.txt','r') thisfile.close()