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)

28th Aug 2020, 10:20 AM
Max Lwe
Max Lwe - avatar
4 ответов
+ 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))
28th Aug 2020, 10:24 AM
R-BIT
R-BIT - avatar
+ 2
In last line, "print (f(7))" . Try this
28th Aug 2020, 10:24 AM
Allamprabhu Hiremath
+ 1
Yea you're right i didn't request it to output result . Any way thanks bro you made my day.
28th Aug 2020, 10:26 AM
Max Lwe
Max Lwe - avatar
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))
11th Oct 2024, 8:04 PM
isadora iurato
isadora iurato - avatar