Skip to content

Commit

Permalink
fizz_buzz py
Browse files Browse the repository at this point in the history
  • Loading branch information
armanmoztar committed Aug 28, 2022
1 parent c5633ca commit 49a7a8e
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 49a7a8e

Please sign in to comment.