+ 12

What does set do?

20th Sep 2020, 3:15 AM
Si Thu Tun
Si Thu Tun - avatar
3 Antworten
+ 7
Sets are useful for removing multiples. print(set([1, 2, 2, 4, 4, 4, 5])) # output {1, 2, 4, 5}
20th Sep 2020, 4:42 AM
David Ashton
David Ashton - avatar
+ 4
A Set is an unordered collection data type that is iterable, mutable and has no duplicate elements. Python's setclass represents the mathematical notion of a set.
20th Sep 2020, 3:16 AM
ㅤㅤㅤ