0
My take on fuzz buzz game .
I am stuck , my code has no output idk why , help needed! def f (input) : if input %3==0 and input %5==0 : return "fizzbuzz" if input %3==0 : return 'fizz' elif input % 5==0 : return("buzz") return input f (7)
4 Réponses
+ 4
def f (input) :
if input %3==0 and input %5==0 :
return "fizzbuzz"
if input %3==0 :
return 'fizz'
elif input % 5==0 :
return("buzz")
return input
👇
Print(f(7))
+ 2
In last line, "print (f(7))" . Try this
+ 1
Yea you're right i didn't request it to output result .
Any way thanks bro you made my day.
0
The issue is that while your function is written correctly, you're not seeing any output because you're not printing the result. To fix this, simply add a print() statement to display the result of calling f(7).
def f(input):
if input % 3 == 0 and input % 5 == 0:
return "fizzbuzz"
if input % 3 == 0:
return "fizz"
elif input % 5 == 0:
return "buzz"
return input
print(f(7))