Reputation: 13
My apologies in advance should I butcher any Python vocabulary, this is my first programming class and we are not permitted to post or share our code. I will do my best to explain the problem.
I am defining my function as variable one and variable two. I then gave values to both variables. I used a for statement with a range value; created a new variable to handle the sum of the two previous Fib. values; and redefine my original variables for the program to iterate through until I reached my maximum.
I am receiving an error message:
<function appendNextFib at 0x01FB14B0>
I cannot find an explanation for what the error message means. From either the message itself or from what I have written, does the fatal flaw jump out at anyone?
Upvotes: 1
Views: 177
Reputation: 1139
While I personally think you may be stressing too much about the sharing of your code, a recursive solution to the problem is a lot more logical and would help you out if your issue is caught up in the declaration of variables.
the recursive solution would look like
def fib(n):
base case:
return val
base case:
return val
else:
return recursive call
Without trying to give too much away I hope this makes sense.
edit: just read that you had included the function id in your initial post, sorry for the confusion this may cause
Upvotes: 0
Reputation: 375844
To invoke your function, you have to use parens: appendNextFib()
. It looks like you simply used appendNextFib
, which would show you its value, which is that function object.
Upvotes: 3