Re: While and If messing up my program?

2005-10-07 Thread CJ
CJ <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: Thanks! I think I've nailed it. I appreciate all the input! -- http://mail.python.org/mailman/listinfo/python-list

Re: While and If messing up my program?

2005-10-05 Thread Steven D'Aprano
On Wed, 05 Oct 2005 06:48:59 +, CJ wrote: > >Hey, I'm new to the Python world, but I do have experience in several > other languages. I've been running through a tutorial, and I decided that > I'd make a program that runs through a list, finds if there are any > duplicates. The progra

Re: While and If messing up my program?

2005-10-05 Thread Steven D'Aprano
On Wed, 05 Oct 2005 00:10:12 -0700, [EMAIL PROTECTED] wrote: > hi, > > to get howmany element list appear you can code: > ttllst=[4,3,45,3] > for x in ttllst: > print x, ttllst.count(x) > pass > > to get non duplicate element list you can code: > ttllst=[4,3,45,3] >

Re: While and If messing up my program?

2005-10-05 Thread Lasse Vågsæther Karlsen
The specific error in your code, is that when cnto == len(ttllst), then doing ttllst[cnto] will give you that error. The list is indexed from 0 to len-1, which means that doing list[len(list)] will give that error. -- http://mail.python.org/mailman/listinfo/python-list

Re: While and If messing up my program?

2005-10-05 Thread Fredrik Lundh
"CJ" wrote: >What does worry me, is that I can't seem to get the program by a > certain spot. It keeps giving me the same error, and I don't know why. quite often, exception messages means exactly what they say; if you get an index error, it's because you're trying to fetch an item that doesn

Re: While and If messing up my program?

2005-10-05 Thread [EMAIL PROTECTED]
hi, to get howmany element list appear you can code: ttllst=[4,3,45,3] for x in ttllst: print x, ttllst.count(x) pass to get non duplicate element list you can code: ttllst=[4,3,45,3] print list(set(ttllst)) Cheers, pujo -- http://mail.python.org/mailman/listinfo/p

While and If messing up my program?

2005-10-04 Thread CJ
Hey, I'm new to the Python world, but I do have experience in several other languages. I've been running through a tutorial, and I decided that I'd make a program that runs through a list, finds if there are any duplicates. The program, doesn't work, but since its a first build I wasn't to