I've searched for the answer for about an hour, and it seems most people have coded fizzbuzz a different way than myself.
However, having tried everything to figure out why this simple code will not work I'm getting extremely frustrated.
Can anyone point out the simple problem I'm sure I'm having? The code runs but it just returns the value 1.
def fizzbuzz(intList):
for n in intList:
if n % 3 == 0 and n % 5 == 0:
return n.replace(str(n),"Fizzbuzz")
elif n % 3 == 0:
return n.replace(str(n),"Fizz")
elif n % 5 == 0:
return n.replace(str(n),"Buzz")
else:
return n
how a python function should look like if we want to see the next result in the interactive mode of the python interpreter: