4 ms·
Doesn't look right. The numbers are missing from the output. If you don't print the numbers, sure it's trivial.
by throwaway150 11mo ago
Doesn't look right. The numbers are missing from the output. If you don't print the numbers, sure it's trivial.
- seanhunter 11mo agoI didn't know that was a requirement. OK then from itertools import cycle fizz = cycle(["","","fizz"]) buzz = cycle(["","","","","buzz"]) for idx, z in enumerate(zip(fizz,buzz)): print(f"{idx}: {z[0]}{z[1]}") Happy now?
- throwaway150 11mo agoThis doesn't look right either. You should really look up what FizzBuzz is. The output should be like: 1 2 fizz 4 buzz fizz You can't just print the number for every line. Check this out - https://rosettacode.org/wiki/FizzBuzz https://rosettacode.org/wiki/FizzBuzz or just run the program in the OP which prints correct output.
- seanhunter 11mo agoI should really look it up because it’s such an important thing to get canonically correct.
- throwaway150 11mo agoIt's not important to look it up. I only suggested it because you posted two programs and neither solve the problem people are discussing here. If you really want to solve a boring version of the problem, by all means you should. I'm nobody to tell you otherwise. All I'm saying is that if you water the problem down into something trivial and boring, the solution will be trivial and boring too. No surprise there. The other answers here are more complicated because they solve the canonical FizzBuzz problem, not the boring version of it that is trivial to solve without conditionals.
- genewitch 11mo agoit's more that fizzbuzz i think is one of the - if not the - simplest way to see if people understand requirements. some of the comments here remind me of thedailywtf.com comment sections.
- nh23423fefe 11mo agobeing correct is good and being confused is bad