Created
June 30, 2014 17:33
-
-
Save ianmcnally/68878e2f5d762f7c2d01 to your computer and use it in GitHub Desktop.
Fizzbuzz
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
fizzbuzz = -> | |
for n in [1..100] | |
fizz = if n % 3 is 0 then 'fizz' else '' | |
buzz = if n % 5 is 0 then 'buzz' else '' | |
output = fizz + buzz or n | |
console.log output |
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(): | |
for i in range(1, 101): | |
fizz = 'fizz' if (i % 3 == 0) else '' | |
buzz = 'buzz' if (i % 5 == 0) else '' | |
output = fizz + buzz or i | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment