Computer Science, asked by gazdon617, 3 months ago

Assignment 9: 2D Arrays

Attachments:

Answers

Answered by kiashantihargrove14
29

Answer:

a = []

for i in range(1):

   a.append([0, 2, 0, 0, 0])

   a.append([0, 2, 0, 0, 0])

   a.append([0, 2, 2, 0, 0])

   a.append([0, 2, 0, 2, 0])

   a.append([0, 2, 0, 0, 2])

def printArray(b):

   for r in range(len(b)):

       for c in range(len(b[0])):

           print((b[r][c]), end = " ")

       print()

def reverse(a):

   temp = []

   for i in range(len(a)):

       temp.append(a[len(a) -1 -i])

   return temp

def flipHorizontal(a):

   temp = a

   for i in range(len(a)):

       temp[i] = reverse(a[i])

   printArray(temp)

def flipVertical(a):

   a.reverse()

   printArray(a)

printArray(a)

print()

flipHorizontal(a)

print()

a = [[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]]

flipVertical(a)

Explanation: It gave me 100%

Similar questions