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 too worried about it. I'd be highly impressed if I got the program to run correctly in the first build, I want to debug it myself later.
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. The code: ttllst=[4,3,45,3] cnto=0 cntt=1 rept=-1 print cnto print cntt print ttllst[cnto] print ttllst[cntt] choice=raw_input("Begin? ") if choice == "yes" or choice == "y": while cnto<>len(ttllst)+1: if ttllst[cnto]==ttllst[cntt]: rept=rept+1 if cntt==len(ttllst): print ttllst[cnto],"appears in the list",rept,"times." cntt=-1 cnto=cnto+1 rept=-1 cntt=cntt+1 print "done." After running the program I get error: Traceback (most recent call last): File "C:\Python24\Projects\repeatfinderlist", line 13, in -toplevel- if ttllst[cnto]==ttllst[cntt]: IndexError: list index out of range Now, if I remove the while, and the If/choice lines like so: ttllst=[4,3,45,3] cnto=0 cntt=1 rept=-1 print cnto print cntt print ttllst[cnto] print ttllst[cntt] if ttllst[cnto]==ttllst[cntt]: rept=rept+1 if cntt==len(ttllst): print ttllst[cnto],"appears in the list",rept,"times." cntt=-1 cnto=cnto+1 rept=-1 cntt=cntt+1 print "done." I get no errors. The program doesn't work, granted, but I get no errors. Can anyone tell me what I'm missing? Thanks! -CJ -- http://mail.python.org/mailman/listinfo/python-list