Last active
August 29, 2015 14:19
-
-
Save zaccrites/c74c98b7a1c45d9d3ce6 to your computer and use it in GitHub Desktop.
Fizzbuzz By a Python Generator Expression
This file contains 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 | |
fizzbuzz = ( | |
('fizz' if i % 3 == 0 else '') + ('buzz' if i % 5 == 0 else '') + (str(i) if i % 3 and i % 5 else '') | |
for i in xrange(1, 100 + 1) | |
) | |
for entry in fizzbuzz: | |
print entry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment