Python Tips
aka Things I can't seem to remember.
Find the last n elements of a list:
foo = random.sample(range(10, 30), 15) foo[:-5:-1]
Iterate over a Dictionary
foo = {'a':3, 'b':7, 'cat':13} for key, value in foo.items(): print(key, value)
aka Things I can't seem to remember.
Find the last n elements of a list:
foo = random.sample(range(10, 30), 15) foo[:-5:-1]
foo = {'a':3, 'b':7, 'cat':13} for key, value in foo.items(): print(key, value)
Python (last edited 2020-05-20 21:46:56 by ChrisSeidel)