Created
January 28, 2015 02:51
-
-
Save junichiro/9c7955db2c07c5631bbe to your computer and use it in GitHub Desktop.
code_iq: 1236
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
# -*- coding: utf-8 -*- | |
class code_iq: | |
def do(self, n): | |
res = [] | |
for v in range(1, n + 1): | |
if v % 3 == 0 and v % 5 == 0: | |
res.append('Fizz Buzz') | |
elif v % 3 == 0: | |
res.append('Fizz') | |
elif v % 5 == 0: | |
res.append('Buz') | |
else: | |
res.append(v) | |
print ", ".join(map(str, res)) | |
if __name__ == '__main__': | |
code = code_iq() | |
code.do(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment