Hi Roelof, See below
On 27 August 2010 16:05, Roelof Wobben <rwob...@hotmail.com> wrote: > > uitkomst = add_vectors[u,v] > > But now I get this error message : > > > Traceback (most recent call last): > *File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 27, in > <module>* > > uitkomst = add_vectors[u,v] > > TypeError: 'function' object is not subscriptable > > > > So it seems that I can't use vectors as a variable in a function. > Carefully compare the syntax for calling your function (as in the doctest) to what you've written above. See the difference? (Hint: check the type of parentheses...) The error message is giving you a hint -- a subscriptable item is something like a list or array. They use square brackets. Function calls always use (round) parentheses. To python, it looks like you're trying to subcript the function object "add_vectors", which obviously isn't possible. Hence the message. Regards, Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor