Last active
August 29, 2015 14:00
-
-
Save ldong/65b00804b138e1a802dd to your computer and use it in GitHub Desktop.
Discussion from http://cnodejs.org/topic/5360a2421a14133a2e00f008
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 | |
import sys | |
CASE1 = 1 | |
CASE2 = 5 | |
CASE3 = 7 | |
WORD1 = 'Fizz' | |
WORD2 = 'Buzz' | |
WORD3 = 'Whizz' | |
def filter(num): | |
if str(CASE1) in str(num): | |
print(WORD1) | |
return | |
if num % CASE1 == 0: | |
sys.stdout.write(WORD1) | |
if num % CASE2 == 0: | |
sys.stdout.write(WORD2) | |
if num % CASE3 == 0: | |
sys.stdout.write(WORD3) | |
def main(): | |
filter(int(raw_input('Please input a number: '))) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment