Remove_duplicates - list out of range error


#1

Here is my code. I am getting list assignment, list out of range.

def remove_duplicates(input_list):
input_list.sort() #sort list in ascending order
matched = True # assume a match exists
new_list = [] # empty new list
new_list_indx = 0
input_indx = 1 # next value in line
value = input_list[0] # get the first value
end_pt = len(input_list)
while input_indx < end_pt:
while matched and (input_indx < end_pt):
if (input_list[input_indx] != value):
new_list[new_list_indx] = value
matched = False
value = input_list[input_indx]
new_list_indx += 1
input_indx += 1
else:
input_indx += 1
matched = True
new_list[new_list_indx] = value
return new_list