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)
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)
python fizzbuzz solution
# check prime number
def prime(n):
if n > 1:
for i in range(2, n):
if (n % i) == 0:
break
else:
print(n, "prime number")
for num in range(1, 100):
result = ""
if prime(num):
result += "Prime"
else:
if num % 3 == 0 and num % 5 == 0:
result += "FizzBuzz"
print(num, result)
elif num % 3 == 0:
result += "Fizz"
print(num, result)
elif num % 5 == 0:
result += "Buzz"
print(num, result)
else:
print(num)
if __name__ == '__main__':
print('All done')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us