list. remove(object) Removes the first item from the list which matches the specified value.
To solve your purpose we can utilize a data structure name set
which have property to store multiple items in a single variable.
num = [5, 7, 21, 7, 5, 7, 7, 5, 7 , 7]
print(set(num))
If you want to go with your logic instead of using set
data structure checkout this code
num = [5, 7, 21, 7, 5, 7, 7, 5, 7 , 7]
res = []
for i in range(len(num)):
if num.index(num[i])==i:
res.append(num[i])
print(res)
OR
num = [5, 7, 21, 7, 5, 7, 7, 5, 7 , 7]
res = []
for i in num:
if i not in res:
res.append(i)
print(res)