I am out of trial and error again Lists

Ian Kelly ian.g.kelly at gmail.com
Fri Oct 24 19:05:41 CEST 2014


On Fri, Oct 24, 2014 at 10:37 AM, Seymore4Head
<Seymore4Head at hotmail.invalid> wrote:
> If I could explain to you why something doesn't work then I could fix
> it myself.  I don't understand why it doesn't work.  The best I can do
> is repost the code.

You don't need to be able to explain why it doesn't work. You just
need to be able to explain what you expected it to do and what it
actually did. Posting the code and the traceback that you get is a
fine start.

>         if y in lst(range(1,10)):

The name of the builtin is "list". It's a function* that takes an
argument and uses it to construct a list, which it returns.

"lst" is the name of some specific list that you're using in your
code. It's not a function, which is why the error is complaining that
it isn't callable.

*Actually it's a type object, and calling it causes an instance of the
type to be constructed, but for all intents and purposes here it works
exactly like a function.



More information about the Python-list mailing list