Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sunetos
sunetos / fizzbuzz_explained.py
Last active March 28, 2022 00:39
A breakdown of my condensed, obfuscated fizzbuzz for educational purposes
#!/usr/bin/env python
__author__ = 'Adam R. Smith (adam@adamia.com)'
# Loop from 0 through 99. Need zero-based for the later cyclic bit-shifting.
for x in xrange(100):
# There are 4 possible outputs on each iteration of the loop.
# 4 possibilities requires 2 bits to store (0, 1, 2, 3):
# 0 == 00b == the number (x + 1)
# 1 == 01b == 'Fizz' when a multiple of just 3