Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,13 +1 @@
|
|||
from itertools import cycle, izip, count, islice
|
||||
|
||||
fizzes = cycle([""] * 2 + ["Fizz"])
|
||||
buzzes = cycle([""] * 4 + ["Buzz"])
|
||||
both = (f + b for f, b in izip(fizzes, buzzes))
|
||||
|
||||
# if the string is "", yield the number
|
||||
# otherwise yield the string
|
||||
fizzbuzz = (word or n for word, n in izip(both, count(1)))
|
||||
|
||||
# print the first 100
|
||||
for i in islice(fizzbuzz, 100):
|
||||
print i
|
||||
for i in range(100):print(i%3//2*'Fizz'+i%5//4*'Buzz'or i+1)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,13 @@
|
|||
print ('\n'.join(''.join(''.join(['' if i%3 else 'Fizz',
|
||||
'' if i%5 else 'Buzz'])
|
||||
or str(i))
|
||||
for i in range(1,101)))
|
||||
from itertools import cycle, izip, count, islice
|
||||
|
||||
fizzes = cycle([""] * 2 + ["Fizz"])
|
||||
buzzes = cycle([""] * 4 + ["Buzz"])
|
||||
both = (f + b for f, b in izip(fizzes, buzzes))
|
||||
|
||||
# if the string is "", yield the number
|
||||
# otherwise yield the string
|
||||
fizzbuzz = (word or n for word, n in izip(both, count(1)))
|
||||
|
||||
# print the first 100
|
||||
for i in islice(fizzbuzz, 100):
|
||||
print i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue