Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -1,13 +1,6 @@
|
|||
from itertools import cycle, izip, count, islice
|
||||
import random
|
||||
|
||||
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(0, 100):
|
||||
if not i % 15:
|
||||
random.seed(1178741599)
|
||||
print [i+1, "Fizz", "Buzz", "FizzBuzz"][random.randint(0,3)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue