Answers for "buzz fizz python"

2

fizz buzz python

def fizz_buzz(input):
    if (input % 3 == 0) and (input % 5 == 0):
        return "FizzBuzz"
    if input % 3 == 0:
        return "Fizz"
    if input % 5 == 0:
        return "Buzz"
    else:
        return input


print(fizz_buzz(3))
Posted by: Guest on June-22-2020
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)
Posted by: Guest on January-05-2020
0

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')
Posted by: Guest on August-22-2020
0

fizz buzz python

#made by myself :)
def FizzBuzz() :
    Numbers = 0
    for Numbers in range(101):
        if Numbers%3 == 0:
            print ("Fizz")
        if Numbers%5 == 0:
            print ("Buzz")
        if Numbers%3 == 0 and Numbers%5 ==0:
            print ("Fizz Buzz")
        else :
            print (Numbers)
FizzBuzz()
Posted by: Guest on December-06-2020

Python Answers by Framework

Browse Popular Code Answers by Language