I wrote the code for a fizz buzz game, where it prints fizz for multiples of 3 and buzz for multiples of 5. Then fizz buzz for both everything works but the output. Its supposed to print 1: 2: 3: fizz
and so on but mine prints an extra space
1 : 2 : 3 : fizz
I provided the code below thanks for any help
def fizzbuzz(n):
for num in range(1,n+1):
if num % 3 == 0 and num % 5 == 0:
print(num,': FizzBuzz')
elif num % 3 == 0:
print(num,": Fizz")
elif num % 5 ==0:
print(num,": Buzz")
else:
print(num,":")
fizzbuzz(n=21)