On 25/12/11 10:18, daedae11 wrote:
The following program has an error :
new += lists[int(j)]+"-";
UnboundLocalError: local variable 'new' referenced before assignment

Others have answered the question for you however there are two additional points to make:

1) Always send the complete erroir message not just the last line.
2) You do not need semi-colons at the end of lines in Python.

lists =
['zero','one','two','three','four','five','six','seven','eight','nine'];
new = "";

No need for them here

for j in iput:
new += lists[int(j)]+"-";
print new[0:-1];
if __name__ == "__main__":
main();

Nor here.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to