I am learning python from Youtube and want to write a python code which removes duplicates from the list. This is my code :
nums = [1,1,2,2,2,2,3,3,4,8,5,6,6,4,4,7,5,8]
j = 1
for i in nums :
if nums.count(i) > 1 :
while j < nums.count(i) :
nums.remove(i)
j += 1
print(nums)
I know there are other ways to do it but i want to know why this one isn't working. are the all the modules correct?