Skip to content

Commit

Permalink
Merge pull request #71 from armanmoztar/fizz_buzz-python
Browse files Browse the repository at this point in the history
fizz_buzz py
  • Loading branch information
ademclk authored Aug 28, 2022
2 parents c5633ca + 49a7a8e commit 4cb7b70
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions challenges/Python/fizz_buzz/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def fizz_buzz(n):
res = []
for i in range(1, n+1):
str = ""
if i % 5 == 0:
str += "Buzz"
if i % 3 == 0:
str += "Fizz"
if i % 5 != 0 and i % 3 != 0:
str += str(i)
res.append(str)
return res

0 comments on commit 4cb7b70

Please sign in to comment.