Created
September 21, 2018 15:30
-
-
Save genbtc/e6ad90913d1b215195d7ad4d8cc90f9b to your computer and use it in GitHub Desktop.
FizzBuzz test implementation done in Python (Fizz Buzz)
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 xrange(1,101): | |
if (i % 15 == 0): | |
print("FizzBuzz"); | |
elif (i % 5 == 0): | |
print("Buzz"); | |
elif (i % 3 == 0): | |
print("Fizz"); | |
else: | |
print(i); | |
return 1; | |
if __name__ == "__main__": | |
fizzBuzz(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use range instead of Xrange, and the semicolons are because I'm used to C++. Print is using parentheses.
The main part signifies if its being ran from the command line and to automatically run that function.