def problem
Lloyd Zusman
ljz at asfast.com
Sat Feb 10 17:16:39 EST 2001
clickron at webtv.net writes:
> I write this, save it. and run it.
> def hello():
> print "hello"
> print "bye bye"
> hello()
> and I get this message
> hello
> Traceback innermost last):
> File "<pyshell27>",line 1, in ?
> hello
> NameError: There is no variable named 'hello'
> What am I doing wrong?
Python is a language for which proper indentation is essential.
Try this:
def hello():
print "hello"
print "bye bye"
hello()
[Also, note the blank line after the function definition]
Does this work any better for you?
> [ ... ]
>
> Ron
--
Lloyd Zusman
ljz at asfast.com
More information about the Python-list
mailing list