Skip to content

Instantly share code, notes, and snippets.

@genbtc
Created September 21, 2018 15:30
Show Gist options
  • Save genbtc/e6ad90913d1b215195d7ad4d8cc90f9b to your computer and use it in GitHub Desktop.
Save genbtc/e6ad90913d1b215195d7ad4d8cc90f9b to your computer and use it in GitHub Desktop.
FizzBuzz test implementation done in Python (Fizz Buzz)
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();
@genbtc
Copy link
Author

genbtc commented Sep 21, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment