# http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
#
# Task:
#
# Write a program that prints the numbers from 1 to 100.
# But for multiples of three print "Fizz" instead of the number and
# for the multiples of five print "Buzz". For numbers which are multiples
# of both three and five print "FizzBuzz".
#
from sys import stdout
# fixed range
for i in
divisible = False
if i % 3 == 0:
stdout.write("Fizz")
divisible = True
if i % 5 == 0:
stdout.write("Buzz")
divisible = True
if not divisible:
stdout.write(str(i))
stdout.write('\n')
# This solution only uses 2 modulus operations to work, instead of the
# original post which had to compute 4 modulus operations.
#
# Using stdout instead of print allows you to omit printing the trailing newline
# character which the print function always prints, and makes it possible to
# only use 2 modulus operations.
#
# If you have to output the number, then I think the cleanest way to do it is to
# use the divisible variable. You can alternatively use nested if statements
# instead of the divisible variable, but I think it's not as readable as the
# above version.
#
# I think this solution is in the spirit of the task, especially since that
# Fizz, Bang, and FizzBang are printed INSTEAD of the number, not along with it
# as in the original post.