Skip to content

Commit 90fe886

Browse files
burzblakeembrey
authored andcommitted
Shorter shortest-fizz-buzz for python{2,3} (blakeembrey#181)
1 parent d731921 commit 90fe886

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
def shortest_fizz_buz():
2-
for i in xrange(0, 100):
3-
s = ''
4-
ss = False
5-
if ((i + 1) % 3 == 0):
6-
s +='Fizz'
7-
if ((i + 1) % 5 == 0):
8-
s +='Buzz'
9-
if ((i + 1) % 3 > 0 and (i + 1) % 5 > 0):
10-
print(i + 1)
11-
else:
12-
print(s)
1+
for i in range(1,101):
2+
o=''if i%3else'Fizz'
3+
if i%5==0:o+='Buzz'
4+
print(o if o else i)

0 commit comments

Comments
 (0)