Instruction
Let's compare sort() and sorted():
sort()works in place. After invoking the function, thebooksvariable is immediately modified.
Syntax:books.sort().sorted()creates a sorted copy of the list. The original list is not modified, so remember to assign the result ofsorted()to a variable if you want to reuse it!
Syntax:sorted_books = sorted(books).
Exercise
Take a look at the template code. The get_positive_elements_sorted(input_list) function should accept a list with numbers, filter out non-positive numbers, sort the remaining positive numbers, and return a sorted copy of the list with positive numbers only. However, something is wrong – the elements are not sorted when returned from the function.
Investigate the problem, and fix the function.
Stuck? Here's a hint!
Note that sorted(list_to_return) returns a sorted copy of the list, but the function does nothing with the copy.



