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. In questions involving code which will PARTIALLY be given to you in the question specs, you may need add new lines. There may not be information given as to where the lines should be inserted. MAKE SURE TO RUN THE CODE IN PROBLEMS THAT INVOLVING CODE! QUESTION -ext .py -run 'python omsi_answer1.py' The code below will descend through a directory tree, recording all the file names, forming groups according to suffix. It will return a Python dictionary, with keys equal to the suffixes it found, and a count of the number of files found for each suffix. See the example. Fill in the blanks. import os,sys def getSuffix(s): tmp = s.split('.') if len(tmp) == 1: return None return tmp[-1] def inspectFileNames(dct,dr,flst): suff = getSuffix(f) if suff == None: continue def countLikeFiles(): fileGrps = {} os.path.walk('.',inspectFileNames,fileGrps) return fileGrps # create test; make directory 'testcase', with files 'abc.x' and # 'def.y', and a subdirectory 'a' with a file 'ghi.y'; in the end the # function 'countLikeFiles()' will return a dictionary like # {'y': 2, 'x': 1} try: os.mkdir('testcase') except: pass os.chdir('testcase') top = os.getcwd() try: f = open('abc.x','w') f.close() f = open('def.y','w') f.close() except: pass try: os.mkdir('a') except: pass os.chdir('a') try: f = open('ghi.y','w') f.close() except: pass os.chdir(top) print countLikeFiles() QUESTION -ext .py -run 'python omsi_answer2.py' Here you will write a class 'mtrx', to store a matrix. It will have instance variables 'm', 'nr' and 'nc', which are the matrix, the number of rows and the number of columns. The variable 'm' will be 1-dimensional, i.e. a list (not a list of lists), storing the matrix in row-major order. There will be instance methods 'getElement' and 'putElement' to read/write from/to a specific element of the matrix, and 'mulvec' to multiply a specified vector by the matrix class mtrx: z = mtrx([1,2,3,8,9,10],3) # storing the 3 x 2 matrix # 1 2 # 3 8 # 9 10 print z.getElement(1,1) # 8 z.putElement(1,0,12) print z.m # [1,2,12,8,9,10] print z.getElement(1,0) # 12 print z.mulvec([5,-2]) # [1,44,25]