Daniel F. answered 06/06/22
Professional Developer Specializing in Python
The trick of this question lies in reducing the scenario given such that only the information from `pairs` is needed.
decide if the input list is sorted in ascending order and has no repetition.
Here we can see that there are really two things to look for: 1) ascending order of each element and 2) non-repetition. There are various ways we could go about solving this sort of problem, but the scenario given means we're going to be operating around `pairs` in an iterative fashion; in fact, we only need to look at one pair at a time.
Which of these pairs meet the criteria given? How can we discern this programmatically? More specifically, how can we compare the two elements of the pairs to get the right result?
Now, we're also required to use a list comprehension, so we might want to invert our check, put it in a condition, and use something like `null` to figure out whether our array passes the test.