Jun-22-2019, 07:23 PM
(This post was last modified: Jun-22-2019, 07:23 PM by abdielG252.)
Hello I'm new in this page. I'm a beginner in python, and i have a question about this program.
I need to do this exercise:
Write a program to remove the duplicates in a list.
And i write this program:
Can anyone tell my why this program doesn't work?
Sorry for my English, I'm learning. Thanks and regards
I need to do this exercise:
Write a program to remove the duplicates in a list.
And i write this program:
n = [5, 3, 6, 7, 5, 5, 6, 7, 8, 3, 6, 5, 7, 8, 3, 4, 6, ] for i in n: if n.count(i) > 1: n.remove(i) print(n)this is the answer: [5, 7, 3, 5, 7, 8, 3, 4, 6]
Can anyone tell my why this program doesn't work?
Sorry for my English, I'm learning. Thanks and regards