Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactored to eliminate third slicing operation
  • Loading branch information
kgashok committed May 25, 2020
commit 899c249f2a1510aafe26cacb15ffe7f82784eba3
5 changes: 2 additions & 3 deletions recipes/Python/576612_FizzBuzz/recipe-576612.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from math import ceil

N = 101
n = map(str, range(N))
n = range(N)
n[::3]=['Fizz']*int(ceil(N/3))
n[::5]=['Buzz']*int(ceil(N/5))
n[::15]=['FizzBuzz']*int(ceil(N/15))
n[::5]= [ t + "Buzz" if type(t) == str else "Buzz" for t in n[::5] ]

print '\n'.join(str(n) for n in n[1:])