Page 1 of 1

X Problem 7 - Order testing (3 x 5 points] All functions you are asked to define for this problem should accept the same

Posted: Sat May 14, 2022 8:34 pm
by answerhappygod
X Problem 7 Order Testing 3 X 5 Points All Functions You Are Asked To Define For This Problem Should Accept The Same 1
X Problem 7 Order Testing 3 X 5 Points All Functions You Are Asked To Define For This Problem Should Accept The Same 1 (36.91 KiB) Viewed 64 times
X Problem 7 Order Testing 3 X 5 Points All Functions You Are Asked To Define For This Problem Should Accept The Same 2
X Problem 7 Order Testing 3 X 5 Points All Functions You Are Asked To Define For This Problem Should Accept The Same 2 (67.84 KiB) Viewed 64 times
X Problem 7 - Order testing (3 x 5 points] All functions you are asked to define for this problem should accept the same kind of arguments: a list of values that can be compared against each other. All functions return a boolean value, but based on different criteria (as stated below). Finally, none of the functions 2 should modify their input list in any way. This term is sometimes used in time when analysin... You only need to know that you can use <---and all the other comparison operators between any two elements of the input list. That in the case it, os. the elements of the input listar.e. all number or all strings, or all intes 33:136:358 Spring 2022 Homework 3 Due date: 5/9 Femark You may use the all built-in function, if you wish In general, you can use any built-in functions or standard library functions (no external dependencies, of course) unles explicitly mentioned otherwise for a particular problem.

Remark: You may use the all) built-in function, if you wish. In general, you can use any built-in functions or standard library functions (no external dependencies, of course), unless explicitly mentioned otherwise for a particular problem. Problem 7.1-listlib.is ascending() Returns True if the elements of the input list are in non- decreasing order, and False otherwise. Problem 7.2-listlib.is.descending () Returns True if the elements of the input list are in non- increasing order, and False otherwise. Problem 7.3 - list lib.is.sorted() Retums True if the elements of the input list are in either non- decreasing or non-increasing order, and False otherwise. Hint [1] The formal definition of non-decreasing should tell you how to implement is ascending: a sequence as, a1,...,UN 1 is non-decreasing it and only if a sa for all 1 Si<N. In case the "for all phrasing isn't clear, another way to state the definition is that (doa) and (di Saz) and and (N-23 an-1) should be true. Once you've implemented in ascending, it should be very easy to also do Es descending Hint (2) Just in case the definition of sorted (ie., either non-decreasing or non-increasing) is not that a dor(24) should be true for all I si < N (actually, this statement is a logical tautology, ie it is always trivially true). Don't over-complicate, if you use in ascending and is descending then the implementation of il_norted should be fairly trivial.