Duplicate values

how does this code work to remove duplicate values

s=map(int,input().split())
d={}

for i in s:
    try:
        d[i]+=1
    except:
        print(i,end=" ")
        d[i]=1

I would say try to run it onto this: http://pythontutor.com/visualize.html#mode=edit

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

I’m guessing that you didn’t write this code. How would you solve the problem to remove duplicates (there are many ways to skin this cat)? What parts of this code do you understand? Which parts confuse you?

No, i havent
i am a beginner in python
i want to understand how it works

Alright then just like ArieLeslie said what part is it that you do understand?
If the answer is completly nothing I would recomend you to do a course in python to learn the first basic steps.
Just like with biology you first will need to understand the basic’s before you can disect