Phyton course problem - fizz_buzz exercise

Hi guys I’m a beginner with Python.
I’m doing the fizz_buzz exercise, after copy the exact code Mosh did. I got an error.

this is my code (exactly has Mosh’s)

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”

return input

print(fizz_buzz(3))

HERE IS THE ERROR MESSAGE I GOT



if (input % 3 == 0) and (input % 5 == 0):
^
IndentationError: expected an indented block



The error message says it all: You need to indent the code inside your function.

1 Like

Hi,
I can help you on the same

Hi there!
The IF statements are not indented, thus they are not part of the function.

1 Like

The function definition is a new block of code. No indentation on your code

I correct the problem, It was an indentation issue on the IF’s statements.
Thank you guys for your help.

hi May I help you in this regard