So I'm quite new to coding and I was experimenting with all the different fizzbuzzs' and I came across one using dicts.
When I run it I can easily make any parameters change with 1 keystroke change, which is nice, but I can't figure out why it prints fizzbuzz first, and then it does all of the fizzbuzzs' I choose.
Here is the code I'm using:
def fizzbuzz(multiples, *args):
for i in range(*args):
output = ''
for multiple in multiples:
if i % multiple == 0:
output += multiples[multiple]
if output == '':
output = i
print(output)
multiples={3:Fizz,5:Buzz}
fizzbuzz(multiples, 145)
stall = input("")
The output will go: FizzBuzz 1 2 Fizz ...etc.
It makes it look like 0 is a FizzBuzz...
For educational purposes: for why that?
Thank you.