I am asked to get a list of non-repetitive numbers. Below is my code and the error is TypeError: ‘int’ object is not iterable on line 7. I don’t get it. Please help.
def remove_duplicates(a):
if a == []:
print([])
else:
b = [a[0]] # build a 'b' list which has the first number in 'a' list
a = a.pop(0) # delete the first number in 'a' list
for num in a: # iterates from the second number in the input list
if num not in b:
b.append(num)
return b