I'm trying to make a function that returns this:
42334
44423
21142
14221
From this:
polje = [[1, 2, 4, 4], [4, 1, 4, 2], [2, 1, 4, 3], [2, 4, 2, 3], [1, 2, 3, 4]]
The function just goes through the lists and prints their elements starting with the last ones. I've been able to get the right result by printing, but i'm trying to make it so that the function simply returns the result. How do i do it? I've tried generators, single line for loops etc. but notes on the internet are not plentiful and are often writen in a complicated way...
Here's the code i've got so far:
def izpisi(polje):
i = len(polje[0]) - 1
while i >= 0:
for e in polje:
print(e[i], end="")
i -= 1
print("\n")
return 0
generatorfunction ?