Created
September 25, 2018 12:25
-
-
Save ao/963bd3ccb0576529bd22c028240e0d20 to your computer and use it in GitHub Desktop.
Counting in Python using lists
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
# Counting in Python using lists | |
# by Andrew Odendaal (https://ao.gl/counting-in-python-using-a-list/) | |
magic = 0x616f-0x414f | |
numbers = [ | |
(magic/0x186A0), | |
(magic/0x3E8/8), | |
(magic/0x3E8/4), | |
(magic/0o1534-7), | |
(magic/0x3E8/2), | |
(magic/0o2534-1), | |
(magic/0o2544), | |
(magic/0o075/19), | |
(magic/0o064/19), | |
(magic/0o1654) | |
] | |
i = c = numbers[0] | |
while True: | |
print('%d%d' % (c, round(numbers[int(i)]))) | |
i += 1 | |
if i>len(numbers)-1: | |
i = 0 | |
c += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment