Question: Rewrite the provided code for the function issorted(numlist) that takes a single argument numlist in the form of a list of numbers, and returns True
Rewrite the provided code for the function issorted(numlist) that takes a single argument numlist in the form of a list of numbers, and returns True if numlist is in increasing sort-order (noting that ties between adjacent elements are allowed), and False otherwise. In rewriting the code, you should introduce (at least) one more returnstatement, which aborts the function prematurely when a local violation of the sort-order requirement is detected (expect to fail one of the hidden test cases if you don't!).


For example >>> print issorted([3, 4, 5.0, 7])) True >>> print issorted([-1, 8, -3, 8])) False >>> print issorted([1])) True >> print (issorted([])) True program.py 1 -pef issorted(numlist): 2 3. for iin range(1, len(nunlist)): sortbool - True if numlisti]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
