Write Testing Program Screensnot Rate Answer Function Print Torus Sqaure Well F N Cawindo Q43892853
write the testing of the program Screensnot Rate answer here. #Function to print torus sqaure in well f N CAWINDOWSisystem32cmd.exe Idef printArray (torusSquare): bisplay Torus square at the beginning for i in range(3): for j in range(3): print(torusSquare[i][j],’ print() pisplay Torus square after rotation Le #Function to rotate torus square as per tisplay Torus square after rotation U 2 |def rotate(torusSquare, direction, index): 16 #Row roration left Press any key to continue if(direction==’L’ and index«3): vals=torusSquare[index] temp=vals[0] vals[0]=vals[1] vals[1]=vals[2] vals[2]=temp torusSquare[index]=vals #Row roration right elif(direction==’R’ and index<3): vals=torusSquare[index] temp=vals[2] vals[2]=vals[1] vals[1]=vals[0] vals[0]=temp torusSquare[index]=vals #column rotation up elif(direction==’U’ and index<3): temp=torusSquare[0][index] torusSquare[0][index]=torusSquare[1][index] torusSquare[1][index]=torusSquare[2][index] torusSquare[2][index]=temp #column rotation down elif(direction==’D’ and index<3): temp=torusSquare[2][index] torusSquare[1][index]=torusSquare[0][index] torusSquare[2][index]=torusSquare[1][index] torusSquare[0][index]=temp #function to do play ]def TorusSquare(filename): #create a torux sqaure torusSquare=[] #file open to read with open(filename) as fp: i=0 j=0 while True: #Read line by line line = fp.readline() #end of file check if not line: break else: 1st=[] #First 3 lines for torus square creation if(i<3): line=line.rstrip(‘n’) 1st=line.split(‘ ‘) vals=[] for val in 1st: vals.append (int(val)) torusSquare.append (vals) i+=1 #Next for number of rotations elif(i==3): print(‘Display Torus square at the beginning’) printArray(torusSquare) j=int(line.rstrip(‘n’)) i+=1 #Read rotations and call function to do elif(j>0): line=line.rstrip(‘n’) 1st=line.split(‘ ‘) rotate(torusSquare,lst[0],int(1st[1])) print(‘nDisplay Torus square after rotation’,line) printArray (torusSquare) j-=1 #After finishing number of rotattions else: break #Test #Call Play function and pass file name TorusSquare(“test.txt”) Show transcribed image text write the testing of the program
Screensnot Rate answer here. #Function to print torus sqaure in well f N CAWINDOWSisystem32cmd.exe Idef printArray (torusSquare): bisplay Torus square at the beginning for i in range(3): for j in range(3): print(torusSquare[i][j],’ print() pisplay Torus square after rotation Le #Function to rotate torus square as per tisplay Torus square after rotation U 2 |def rotate(torusSquare, direction, index): 16 #Row roration left Press any key to continue if(direction==’L’ and index«3): vals=torusSquare[index] temp=vals[0] vals[0]=vals[1] vals[1]=vals[2] vals[2]=temp torusSquare[index]=vals #Row roration right elif(direction==’R’ and index
Expert Answer
Answer to write the testing of the program Screensnot Rate answer here. #Function to print torus sqaure in well f N CAWINDOWSisyst…
OR