1

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?

1
  • Upvoted for a well-written, descriptive question that shows you're making an effort rather than just saying "gimme-teh-codez". Commented Nov 11, 2009 at 23:12

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Two hours I have sat here, and it was that simple. Thank you!
If you really want to thank me, accept the answer! Linda? D'oh... :(
Had to find the "boy am I happy to accept the answer button" ;) Lesson learned, mistake not to be repeated. Seriously....thank you all for such quick replies.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.