Created
September 11, 2017 15:21
-
-
Save lucaslugao/70aa467d8648ec0106abfb85a925febb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
from functools import partial | |
def main(): | |
""" | |
Main function | |
""" | |
A = list(range(10)) | |
n = 3 | |
foo = lambda x, y: x**2 + y | |
bar = partial(foo, 1) | |
for x in [A[n]] + [y for i, y in enumerate(A) if i != n]: | |
print(x) | |
print('---') | |
for x in sorted(A, key=lambda y: y != n): | |
print(x) | |
print('---') | |
for x in (A[(n+i) % len(A)] for i in range(len(A))): | |
print(x) | |
print('---') | |
for i, x in enumerate(A): | |
print(i, x) | |
for i, x in zip(range(len(A)), A): | |
print(i, x) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment