I am creating a program, and I have shortened the code to this to try and work out why the return statement is not working and printing the new value of 'answer' after I have run it through my function. It is saying that the answer variable is not defined. But I have tried to set the answer to zero at the start of the program to see if this will solve the issue, but this just prints 0.
Here is my code:
def addition():
answer = 1+2
return answer
addition()
print(answer)
I hope you can help :) Thank you