Tekromancer on Nostr: Next time you have a job interview where someone wants you to write fizzbuz... ``` ...
Next time you have a job interview where someone wants you to write fizzbuz...
```
#!/usr/bin/env python
from itertools import count, cycle
def fizzbuzz():
blank = [""]
yield from (
a + b or c
for a, b, c in zip(cycle((blank * 2 + ["fizz"])), cycle((blank * 4 + ["buzz"])), count(1))
)
lol = fizzbuzz()
for i in range(20):
print(next(lol))
```
If that doesn't short circuit the live coding portion of the day, you don't want to work there anyway.
```
#!/usr/bin/env python
from itertools import count, cycle
def fizzbuzz():
blank = [""]
yield from (
a + b or c
for a, b, c in zip(cycle((blank * 2 + ["fizz"])), cycle((blank * 4 + ["buzz"])), count(1))
)
lol = fizzbuzz()
for i in range(20):
print(next(lol))
```
If that doesn't short circuit the live coding portion of the day, you don't want to work there anyway.