Created
December 18, 2019 15:21
-
-
Save ClaudiuCreanga/6f920badab36067cdb4e3b9a52355332 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array[~i] gets the equivalent from the end | |
so if i = 0, n[~i] is len(n) - 1 and so on. | |
def loopbothways(n): | |
i = 0 | |
while i < len(n) // 2: | |
print(n[i]) | |
print(n[~i]) | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment