0
Functions set and sort
What are they doing?
1 Answer
+ 2
āset()ā is a function, but āsort()ā is a method. āsorted()ā is a function. āset()ā will return all distinct elements of a list, set etc., for example, if you set([1,2,2,3,3,3]) it will become {1,2,3} since 1, 2 and 3 are the only distinct numbers in this list. āsort()ā can be applied to lists and āsorted()ā to lists, sets and tuples... (āsorted()ā will return a list and āset()ā a set) Hereās how each of them works:
https://code.sololearn.com/cgg0gpmuyHZ6/?ref=app