Just started teaching myself how to code, however I've run into a bit of annoying Python syntax problem. Every time I try to copy the examples from my textbook directly into IDLE, I get a syntax error. Even after retyping it, trying different indentations, and so on. I apologize this is so basic! Also is there a way to "recall" the above problem code after it's been entered? Thanks!
>>> def f(x, y, z):
return x + y + z
result = f(1, 2, 3)
print(result)
--OR--
def f(x, y, z):
return x + y + z
result = f(1, 2, 3)
print(result)
I get "syntaxerror: invalid syntax" (on the 'result' line.)
Expected answer is 6.