How do work 'set' to delete duplicated value in python?

35 views Asked by At

As you know, set, one of the Arrays in python, can delete duplicated value.

like this

thisset = {"apple", "banana", "cherry", "apple"}

to

thisset = {"apple", "banana", "cherry"}

The wondering thing is 'How do set can do this?'

Has set a loop about every each value for finding whether it has duplicated value?

this way looks so inefficient. So I think is's wrong.

I want to know the delete process. Please answer me.

I search it useing my question title, but I could see only about to delete in 'list'.

0

There are 0 answers