General FizzBuzz: Difference between revisions

m
→‎{{header|Python}}: Removed unnecessary import and empty line; changed order in example output.
(→‎{{header|Python}}: Changed last example to preserve order and duplicate moduli; changed variable names in previous example.)
m (→‎{{header|Python}}: Removed unnecessary import and empty line; changed order in example output.)
Line 1,563:
 
'''Another version, using ranges with step 3, 5, etc. Preserves order and duplicate moduli.'''
<lang Python>from collections import defaultdict, OrderedDict
 
n = 100
Line 1,595:
 
print(fizzbuzz(n, mods))
 
</lang>
{{Out}}
<pre>
>>> mods = [
... (84, 'eight...Four '),
... (2, 'Two '),
... (6, 'six '),
... (48, 'Foureight... '),
... (6, 'HA! SIX!'),
... (8, 'eight... '),
... ]
>>> print(fizzbuzz(16, mods))