fizz buzz python duplicate values code example
Example 1: fizzbuzz python
def fizz_buzz(num):
if num % 3 == 0 and num % 5 == 0:
return "fizzBuzz"
elif num % 3 == 0:
return "fizz"
elif num % 5 == 0:
return "buzz"
else:
return num
Example 2: how to make fizzbuzz in python
for x in range(100):
output = ""
if x % 3 == 0:
output += "Fizz"
if x % 5 == 0:
output += "Buzz"
print(output)