In python, i need to create a function that has only one parameter and accepts a nested list of RGBA from an image.
I want to flip the image horizontally from left to right like this
Left (Original) and Right (output)
Is this possible to do using for loop? If yes, can you provide an example code that I can follow.
Thank you
>Solution :
def flip_image(image):
flipped_image = []
for row in image:
flipped_row = row[::-1] # This reverses the order of the elements in the row
flipped_image.append(flipped_row)
return flipped_image