return
statement used outside of a function or method FLK-F70630if __name__ == "__main__":
31 complex_num = ComplexNumber(2, 5)
32 real_num = RealNumber(32)
33 return real_num + complex_num
A return
statement should not be used outside of a function or method. This will raise a SyntaxError
. Make sure that your code and indentation are correct.
def fibonacci(n):
'''Returns n'th fibonacci number'''
if n <= 1:
return 1
return fibonacci(n-1) + fibonacci(n-2) # Bad indentation, returning outside function
def fibonacci(n):
'''Returns n'th fibonacci number'''
if n <= 1:
return 1
return fibonacci(n-1) + fibonacci(n-2)