DESCRIPTION Students: Please keep in mind the OMSI rules. Save your files often, make sure OMSI fills your entire screen at all times, etc. Remember that clicking CopyQtoA will copy the entire question box to the answer box. *********************************************************************** * * * Don't forget to FREQUENTLY save and submit your work, even work * * in progress. The network may get busy at the end of the exam * * period, making it difficult to submit then. The server will shut * * down at the appointed time, and NO further work will be accepted. * * * ********************************************************************** In questions involving code which will PARTIALLY be given to you in the question specs, you need to add new lines. There may not be information given as to where the lines should be inserted. Do not modify the lines already there unless instructed to do so. If a question includes test code, make sure to include it in your submission. IF YOU FINISH EARLY, please leave the exam room. If you stay, close your laptop and sit quietly. QUESTION -ext .py -run 'python omsi_answer1.py' (15 pts) Consider the SimPy example, Sec. 6.2.7.1. State all functions, if any, whose execution causes an iterator to be generated. QUESTION -ext .py -run 'python omsi_answer2.py' (85 pts) Write a Python generator to do the following. It will read in an input file containing positive integers, one per line. It will read in the numbers, accumulating them until either it reaches a total of at least m*c, or end-of-file is encountered. The generated iterator will emit the current total each time it reaches or surpasses k*c, k = 1,2,...,m-1. Note: f.readline() on a file f will return 1 line if no argument; f.readline() will return '' when end-of-file is encountered; use int() to convert from string to integer Complete the code: def accumulate(fl,m,c): try: g = open('v','w') g.writelines('5\n12\n13\n8\n88\n') g.close() except: pass acc = accumulate('v',6,6) for r in acc: print r # prints 17,30,38, one number per line