Skip to content

Instantly share code, notes, and snippets.

@sophiezhng
Last active April 28, 2021 22:35
Show Gist options
  • Save sophiezhng/1bdf142da57751208be470c6c3394e40 to your computer and use it in GitHub Desktop.
Save sophiezhng/1bdf142da57751208be470c6c3394e40 to your computer and use it in GitHub Desktop.
Fizz Buzz Python Solution
def main():
fizz_buzz(100)
return
def fizz_buzz(n):
for i in range(1,n+1):
output = ""
if i % 3 == 0:
output += "Fizz"
if i % 5 == 0:
output += "Buzz"
if output == "":
output += str(i)
print(output)
return 0;
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment