sorted
is a built-in function in Python that returns a sorted list of the specified iterable object. This function returns a new sorted list from the elements of the given iterable object.
When working with sets, the order of the elements is not guaranteed. So, we use the sorted
function to get a sorted list from the set.