plz solve this question

Answers
We need to print the smallest and largest elements in a non-empty list of integers stored in 'L' without using a loop.
There are two methods that enable us to sort the list.
- sort()
- sorted()
sort() is a method that permanently sorts the list.
sorted() is a method that does not permanently sort the list.
You can however store a sorted() list into a new variable.
Now, coming back to the question, we're given with the list 'L'.
>>> L.sort() #this sorts the list
>>> print("The smallest element is: ", L[0]) #prints the first element in the list
>>> print("The largest element is: ", L[-1]) #prints the last element in the list
Once the list is sorted, it's obvious that the smallest element will be the first element in the list and the largest will be the last. To obtain those elements, you use list indexing.
You can even sort the list in descending order, by simply using this syntax:
- <list_name>.sort(reverse = True)
- sorted(<list_name>, reverse = True)