Merge pull request 'Aufgabe 1 Codewars' (#2) from aufgabe1 into master
Reviewed-on: #2
This commit is contained in:
commit
890bad0fda
18
src/codewars/snail.py
Normal file
18
src/codewars/snail.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
def snail(array):
|
||||||
|
result = []
|
||||||
|
|
||||||
|
while array:
|
||||||
|
result += array.pop(0)
|
||||||
|
|
||||||
|
if array and array[0]:
|
||||||
|
for row in array:
|
||||||
|
result.append(row.pop())
|
||||||
|
|
||||||
|
if array:
|
||||||
|
result += array.pop()[::-1]
|
||||||
|
|
||||||
|
if array and array[0]:
|
||||||
|
for row in reversed(array):
|
||||||
|
result.append(row.pop(0))
|
||||||
|
|
||||||
|
return result
|
||||||
Loading…
x
Reference in New Issue
Block a user