Question: for python users Wolte a function is_sorted which takes as input a list of numbers L and returns True if 111 c1[11] for all non-negative
Wolte a function is_sorted which takes as input a list of numbers L and returns True if 111 c1[11] for all non-negative indices 1 for which this condition makes sense, and False otherwise. For example, is_sorted (1,2,31) and is_sorted([1,2,2,3,3,31) should all be True, while is_sorted(11,3,21 and is_sorted(11.2.11) should be false In 1: det is_sorted(L): # YOUR CODE HERE raise Not ImplementedError() In 1: assert is_sorted([1,2,31) assert is_sorted(11,2,2,3,3,31) In 1: assert not is_sorted( 11,3,21) assert not is_sorted(11,2,1))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
