Created
December 15, 2012 01:11
-
-
Save ahawker/4290196 to your computer and use it in GitHub Desktop.
FizzBuzz in Python (2.7).
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
#!/usr/bin/env python | |
def main(): | |
for x in xrange(1, 101): | |
div3 = x % 3 == 0 | |
div5 = x % 5 == 0 | |
if div3 and div5: | |
print 'FizzBuzz' | |
elif div3: | |
print 'Fizz' | |
elif div5: | |
print 'Buzz' | |
else: | |
print x | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment