Skip to content

Instantly share code, notes, and snippets.

@hiimdoublej
Created June 13, 2018 12:18
Show Gist options
  • Save hiimdoublej/476549c34bb2be2787a010f1cd5e842c to your computer and use it in GitHub Desktop.
Save hiimdoublej/476549c34bb2be2787a010f1cd5e842c to your computer and use it in GitHub Desktop.
class Solution(object):
def fizzBuzz(self, n):
"""
:type n: int
:rtype: List[str]
"""
result = []
for i in range(1,n+1):
word = ''
if i%3 == 0:
word += 'Fizz'
if i%5 == 0:
word += 'Buzz'
if len(word) == 0:
word += str(i)
result.append(word)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment