Answer:
# Get input and strip any leading/trailing spaces
inputList = input('Enter list: ').strip()
def issorted(lst):
if len(lst) < 2:
return True
current = 1
prev = 0
while current < len(lst):
# Compare if current value is less than the previous one
if int(lst[current]) < int(lst[prev]):
return False
prev = current
current += 1
return True
# Convert input to list
inputList = inputList.split(' ')
# Print output
if issorted(inputList):
print("The list is already sorted​")
else:
print("The list is not sorted")