How do I call my printArray function in both my flipHorizontal and flipVertical functions in order to flip my code each time it is run?

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:

Instructions 10

Hey @csquare121,

I’m not super familiar with Python, but it sounds like the instructor wants you to call the printArray function from inside both flipHorizontal & flipVertical instead of returning an array.

Maybe something like:

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)
    printArray(Array)

def flipVertical(N):
    newArray = []
    for i in range(0,len(N)):
        newArray.append(N[len(N)-i-1])
    printArray(newArray)

Not sure if this helps at all, but from the comment they gave you, that’s what it sounds like to me.

Good luck!