Answers for "fizzbuzz function python"

4

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
Posted by: Guest on December-05-2020
1

fizzbuzz python

def minInput():
    Min = 1
    return(Min)
def maxInput():
    Max=100
    return(Max)
  
def creator(i):
    item = ""
    
    if task(i,3,"fizz")=="fizz":
        item = item+task(i,3,"fizz")
    if task(i,5,"buzz")=="buzz":
        item = item+task(i,5,"buzz")
    if task(i,7,"pezz")=="pezz":
        item = item+task(i,7,"pezz")
        
    if item == "":
        item = i
    return item

def task(i,d,word):
    if i%d==0:
        return (word)

def main():
    Max = maxInput()
    Min = minInput()
    for i in range(Min,Max):
        print(creator(i))
main()
Posted by: Guest on November-02-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

fizzbuzz program in python

inputValue = int(input("Enter a Number: "))

if inputValue % 3 == 0 and inputValue % 5 == 0 :
    print("fizzbuzz")
elif inputValue % 3 == 0 :
    print("fizz")
elif inputValue % 5 == 0 :
    print("buzz")
else:
    print(inputValue)
Posted by: Guest on August-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language