refractor: added comment and removed infinite loop guardrail
This commit is contained in:
parent
9ff7d9161e
commit
a455b46b72
@ -1,12 +1,10 @@
|
|||||||
def snail(snail_map):
|
def snail(snail_map):
|
||||||
|
# first list in array is always first. So add it to new list snail and pop it from snail_map
|
||||||
snail = [x for x in snail_map[0]]
|
snail = [x for x in snail_map[0]]
|
||||||
snail_map.pop(0)
|
snail_map.pop(0)
|
||||||
|
|
||||||
guardrail = 100
|
# transpone list and append first list to snail. Then pop firt item of snail_map. Loop till snail_map is empty
|
||||||
|
while len(snail_map) > 0:
|
||||||
while len(snail_map) > 0 and guardrail > 0:
|
|
||||||
guardrail -= 1
|
|
||||||
|
|
||||||
snail_map = [list(reversed(x)) for x in snail_map]
|
snail_map = [list(reversed(x)) for x in snail_map]
|
||||||
snail_map = [list(row) for row in zip(*snail_map)]
|
snail_map = [list(row) for row in zip(*snail_map)]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user