| Sigh… Saying the code doesn’t have conditions or booleans is only true if you completely ignore how the functions being called are being implemented. Cycle involves conditionals, zip involves conditionals, range involves conditionals, array access involves conditionals, the string concatenation involves conditionals, the iterator expansion in the for loop involves conditionals. This has orders of magnitude more conditionals than normal fizz buzz would. Even the function calls involve conditionals (python uses dynamic dispatch). Even if call site caching is used to avoid repeated name lookups, that involves conditionals. There is not a line of code in that file (even the import statement) that does not use at least one conditional. So… interesting implementation, but it’s not “fizzbuzz without booleans or conditionals”. |
The technique could be implemented without conditionals, but not in python, and not using iterators.
You could do it in C, and use & and ~ to make the cyclic counters work.
But, like I mentioned, the code in the article is very far from being free of conditionals.