object - oriented programming Help!!
brakedon at hotmail.com
Tue Jul 3 22:45:28 EDT 2001
Simon Brunning <SBrunning at trisystems.co.uk> wrote in message news:<mailman.994164970.2845.python-list at python.org>...
> > From: brakedon at hotmail.com [SMTP:brakedon at hotmail.com]
> > What am I doing wrong? I am trying to learn object oriented
> > programming, but I don't know what I'm doing wrong.
> > >>> import fibonaccii_gui
> > >>> fibonaccii.fib(fibinstance, 100)
> > Traceback (most recent call last):
> > File "<pyshell#2>", line 1, in ?
> > fibonaccii.fib(fibinstance, 100)
> > NameError: name 'fibonaccii' is not defined
> You are importing a module called fibonaccii_gui, then referring to just
> fibonaccii. Replace your 2nd line with:
> fibonaccii_gui.fib(fibinstance, 100)
> And it just might work.
Thank you it finally worked! This is how it evened out. Thank you again!
def fib(self, fibnumber):
a, b = 0, 1
while b < fibnumber:
a, b = b, a+b
fibinstance = fibonaccii()
Call it from the interpreter:
>>> import fibonaccii_gui
1 1 2 3 5 8 13 21 34 55 89
More information about the Python-list