I’m Darshan Hiranandani, encountering a syntax error in my code, and I’m having trouble figuring out what’s causing it. I’m working on a Python script to calculate Fibonacci numbers, and here’s the snippet where I’m getting the error:
def fibonacci(n): if n <= 1 return n else: return fibonacci(n-1) + fibonacci(n-2)
print(fibonacci(5))
The error message I’m getting is: ‘SyntaxError: invalid syntax’ pointing to the line with the ‘if’ statement. Can someone please help me identify what’s wrong with my syntax and how I can fix it?