3 ms·
it always amazes me how Haskell uses the very complex approaches for a very simple problem. Do you want a design that generalizes to zork? Here it is: def
by theamk 1y ago
it always amazes me how Haskell uses the very complex approaches for a very simple problem. Do you want a design that generalizes to zork? Here it is:
def fizzbuzz(i):
return "".join((["fizz"] if (i % 3) == 0 else []) +
(["buzz"] if (i % 5) == 0 else [])
) or str(i)
for i in range(1, 101):
print(fizzbuzz(i))
here is "indication of good modularity" with no monoid in sight, and we did not have to import 3 extra libraries either.