Richard P.

asked • 05/07/24

(Sorted?) Python Question

Write the following function that returns True if the list is already sorted in increasing order:

def isSorted(lst):

Write a test program that prompts the user to enter a list of numbers separated by a space in one line and displays whether the list is sorted or not. Don’t use the Python list sort method in this program. Here is a sample run:

Sample Run 1

Enter list: 1 1 3 4 4 5 7 9 10 30 11

The list is not sorted


Sample Run 2

Enter list: 1 1 3 4 4 5 7 9 10 30

The list is already sorted

2 Answers By Expert Tutors

By:

Rayon W. answered • 05/08/24

Tutor
5 (14)

Experienced Software Engineer Tutor, Unlock Your Coding Potential

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.