Loading...
Loading...
Loading...
A price list should never go down from one item to the next. Print Sorted if every price is at least as big as the one before it. Otherwise print Not sorted.
Sorted or the words Not sorted.Example 1
Input
4 10 20 20 35
Output
Sorted
Equal neighbours are fine.
Example 2
Input
3 10 30 20
Output
Not sorted
20 comes after 30.
Try the problem first. Open one hint at a time.
Compare each price with the one before it. One drop is enough to decide.
Pair the list with itself shifted by one using zip(prices, prices[1:]).
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor