"Carson Wendy" <[EMAIL PROTECTED]> wrote in

> ok, i just started python and i'm stuck on this, could use some help 
> :D
> a='test'
> def f():
>     a=a+'gg'

Welcome to the world of Python.

As a rule when you have a problem tell us what the problem is,
we aren't psychic. Specifically, if you get an error message cut
and paste that error into your email.

Usually the answer to your question will be in the error text,
once you know what to look for.

In your case the answer is that you are defining a new variable
 'a' inside your function, but it depends on 'a' for its value. But
since 'a' (in your function) doesn't exist yet, Python can't give 'a'
a value and complains.

Read the 'Whats in a name?' topic in my tutor for more about this
and how to deal with it.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to