a mathematician/economist/statistician by schooling, a data scientist by trade, and a python hacker by night, skien.cc (pronounced skīəns) is my blog aimed to track explorations in all of the above.
When I applied to Hacker School, one of the application question was FizzBuzz:
Write a program that prints out the numbers 1 to 100 (inclusive). If the number is divisible by 3, print Fizz instead of the number. If it’s divisible by 5, print Buzz. If it’s divisible by both 3 and 5, print FizzBuzz. You can use any language.
(Hacker School has since updated the question slightly, likely to make it more difficult to solve via Google. I’ve left out the updated version intentionally to minimize my effect on Googlability.)
This problem is fairly straight forward, and a good bite size problem to use as an example for different languages and programming styles; it’s similar to “Hello, World!” and “Fibonacci”.
Some Unpythonic Python
I looked at this problem today while showing a friend the Hacker School application, and started thinking about the many ways to tackle the problem just in Python alone. Python, specifically with PEP 8, lays out the ideal way to write Pythonic Python. But Python doesn’t enforce Pythonic Python, so I started thinking, what other kinds of Python could I write this in.
Warning: Very Unpythonic Python ahead. However, all code should work (with Python 2.7.5).
Feel free to tweet me or comment with suggested fixes, or new additions.