I get this error after running the code: list index out of range
I reached the end of the loops so I thought it'd be okay. I read that the list might be damaged or faulty due to the process I used. I really didn't read the hints until after I was done so I wanted to see if I could get by with what I made instead of just redoing it the simple way.
I added a lot of print statements to double check the logic and it seemed okay to me. Is there a way to make this run properly or should I just give up on it and follow what the hint said? I read something about list comprehension but I couldn't quite grasp that concept yet.
Any help is appreciated. Learning Python is fun but I'm not very good at it yet.
words_x = [4, 5, 5, 4] def remove_duplicates(words_x): really_new_list =  new_list =  new_list.append(words_x) print "Setting initial value for new_list!", new_list for x in xrange(0, len(words_x)): match = 0 print "Resetting match variable!", match new_range = len(new_list) print "New range is", len(new_list) for y in xrange(0, new_range): if lower(str(words_x[x])) == lower(str(new_list[y])): print "Duplicate detected!", words_x[x], new_list[y] match += 1 print match print "Y is", y else: print "Clear!", print words_x[x], new_list[y] print "Y is", y if match == 0: new_list.append(words_x[x]) print "Adding to list:", words_x[x] print new_list print "List finalized! (Code line: 26)", new_list return new_list remove_duplicates(words_x)