I am taking a computer science course where I am learning how to code in Python (Python 3) and I wrote some code for an assignment and I got a comment on it from an instructor but I don’t understand what it means and I don’t how to do what the comment instructs. Can someone please help me or show me how to do what the comment wants?
Here are the instructions:
Here is my code:
def printArray(N):
for r in N:
for c in r:
print(c,end = " ")
print()
print()
def flipHorizontal(N):
Array = []
for i in range(0,len(N)):
pos = []
for j in range(0,len(N[0])):
pos.append(N[i][len(N[0])-j-1])
Array.append(pos)
return Array
def flipVertical(N):
newArray = []
for i in range(0,len(N)):
newArray.append(N[len(N)-i-1])
return newArray
Array1 = [[0, 2, 0, 0,0], [0, 2, 0, 0,0], [0, 2, 2, 0,0], [0, 2, 0, 2,0],[0, 2, 0, 0,2]]
printArray(Array1)
flipedHor = flipHorizontal(Array1)
printArray(flipedHor)
flipedVer=flipVertical(Array1)
printArray(flipedVer)
Here is the comment: