发行 FizzBu​​zz

Issue Making FizzBuzz

FizzBu​​zz 规则

Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any number divisible by five by the word buzz. Numbers divisible by 15 become fizz buzz.

我的尝试

x = 0
if x % 3:
    print("fizz")
elif x % 5:
    print("buzz")
else:
    x+=1

不能 100% 确定您是否在征求有关您的代码的建议或其他人如何完成它的示例,但这是我第一次开始学习时我的 python。如果您想了解有关其工作原理的一些信息,请随时询问。

for num in range(0,101):
        if num%3 ==0 and num%5 ==0:
            print("fizzbuzz")
        elif num%3 ==0:
            print("fizz")
        elif num%5 ==0:
            print("buzz")
        else :
            print(num)