0
Can we change lists to sets?. What is the main difference between them?
If we were able to change lists to sets, which changes would be occur on lists?
2 Réponses
+ 2
This small code should answer your question.
https://code.sololearn.com/ccg2NgzjYa68/?ref=app
As you can see, you can change a list into a set using set(list)
A set contains every item only once.
Maybe most important: sets don't support indexing.
0
Just so you know, you can also do {*list} to convert a list to a set.