what is wrong with my python code?

John Machin sjmachin at lexicon.net
Wed Feb 7 16:15:00 EST 2007


On Feb 8, 4:43 am, "Dongsheng Ruan" <r... at jcmills.com> wrote:
> I got feed back saying" list object is not callable". But I can't figure out
> what is wrong with my code.
>
> A=[3,5,4,9,6,7]
> l=len(A)-1
>
> for i in range(l):
>      print A(i)

What the others said, *plus*:

(1)  you are subtracting 1 off the length, so after the change from ()
to [], the last item would not be printed.

(2) have you considered working through a tutorial?

Cheers,
John





More information about the Python-list mailing list