[Tutor] (no subject)

Steven D'Aprano steve at pearwood.info
Sun Sep 5 15:55:32 CEST 2010


On Sun, 5 Sep 2010 11:44:09 pm Roelof Wobben wrote:
> Hello,
>
> I have made this program as solution to a exercise from thinking like
> a computer scientist.
[...]
> But now Im getting this error message :
>
> Traceback (most recent call last):
> File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 33, in
> <module> test = make_empty([1, 2, 3, 4])
> File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 21, in
> make_empty if type(element) == type([]):
> NameError: global name 'element' is not defined
>
>
>
> What went wrong here ?

Read the error message again:

NameError: global name 'element' is not defined

You are trying to use something called "element", but you haven't 
created anything with that name. The error message even tells you were 
the problem is: line 21, in the function "make_empty".



-- 
Steven D'Aprano


More information about the Tutor mailing list