Trying to turn fizzbuzz into a function in python 3
问题 I have only just started to learn python as my first language and whilst i worked out the code for fizzbuzz, i cannot for the life of me get it to do the items below. I also want it to print horizontally instead of vertically. Any help would be great (heads spinning). Create a function which does this. For example fizzbuzz(20) would print 1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,17,fizz,19,buzz def fizzbuzz(n): for x in range (101): if x%3==0 and x%5==0: print("fizz buzz")