1def fizz_buzz(num):
2 if num % 3 == 0 and num % 5 == 0:
3 return "fizzBuzz"
4 elif num % 3 == 0:
5 return "fizz"
6 elif num % 5 == 0:
7 return "buzz"
8 else:
9 return num
10
1def fizz_buzz(input):
2 if (input % 3 == 0) and (input % 5 == 0):
3 return "FizzBuzz"
4 if input % 3 == 0:
5 return "Fizz"
6 if input % 5 == 0:
7 return "Buzz"
8 else:
9 return input
10
11
12print(fizz_buzz(3))
1
2for number in range(1, 101):
3 if number % 3 == 0 and number % 5 == 0:
4 print("FizzBuzz")
5 if number % 3 == 0:
6 print("Fizz")
7 if number % 5 == 0:
8 print("Buzz")
9 else:
10 print([number])
1def fizz_buzz(Ending_number:int):
2 """This is a fizz buzz game the starting number would be taken as 1"""
3 for numbers in range(1,Ending_number):
4 if numbers % 3 == 0 and numbers % 5 == 0:
5 print("fizz buzz")
6 elif numbers % 3 == 0:
7 print("buzz")
8 elif numbers % 35 == 0:
9 print("fizz")
10 else:
11 print(numbers)
12print(fizz_buzz(120))
1def minInput():
2 Min = 1
3 return(Min)
4def maxInput():
5 Max=100
6 return(Max)
7
8def creator(i):
9 item = ""
10
11 if task(i,3,"fizz")=="fizz":
12 item = item+task(i,3,"fizz")
13 if task(i,5,"buzz")=="buzz":
14 item = item+task(i,5,"buzz")
15 if task(i,7,"pezz")=="pezz":
16 item = item+task(i,7,"pezz")
17
18 if item == "":
19 item = i
20 return item
21
22def task(i,d,word):
23 if i%d==0:
24 return (word)
25
26def main():
27 Max = maxInput()
28 Min = minInput()
29 for i in range(Min,Max):
30 print(creator(i))
31main()
1# FizzBuzz in one line. Impress ur boss
2for i in range(21): print((int(i) % 3 == 0)*'Fizz' + (int(i) % 5 == 0)*'Buzz' or i)
3
4# Any string multiplied by False will return nothing.
5# - sabz