Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with this one super stuck, the text input could be anything that you

ID: 3770858 • Letter: I

Question

I need help with this one super stuck, the text input could be anything that you like. A python script is needed to run the following. I really appreciate your effort to help. thanks

Develop, using the MapReduce framework, an application that takes as input the name of a text file (pick any text file you like) and creates a line index. Your application should output the index to a file so words appear in alphabetical order, one word per line; the line numbers, for each word, should follow the word and be output in increasing order.

time) time function, 105 time format directive, 106 time Standard Library module, 105-107 timing) function, 351 timingAnalysis() function, 352 Tk tkinter class, 292 tkinter Standard Library module, 292 unary operator, 20 undo Turtle method, 443, 444 Unicode, 183-186 uniform() random module function, 188 Uniform Resource Locator, see URL uniqueness testing, 357 UNIX, 5 update() dictionary method, 170, 171 UPDATE SOL statement, 409 coordinate system, 31:2 resources, 299

Explanation / Answer

def main():
   print 'Enter the filename ',
   s = raw_input()
   file = open(s,'r') # Open the file
   l = []
   for line in f:
       l.append(line.split(','))
   l = sorted(l) # Sort the file in increasing order to output in alphabetic order
   # Display output
   for line in l:
       for i in range(len(line)-1):
           print line[i]+', '
       print l[len(line)-1]

main()