Created
April 28, 2010 18:46
-
-
Save quandyfactory/382532 to your computer and use it in GitHub Desktop.
fizzbuzz solution in 5 lines of code (plus 1 line docstring).
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
def fizzbuzz(start=1, end=100, fizzval=3, buzzval=5): | |
"""Implements Reginald Braithwaite's FizzBuzz text.""" | |
for i in range(start, end+1): | |
fizz = 'Fizz' if i % fizzval == 0 else '' | |
buzz = 'Buzz' if i % buzzval == 0 else '' | |
print i if fizz+buzz == '' else fizz+buzz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment