check list is in ascending order python code example
Example 1: how to sort list in ascending order in python
# vowels list
vowels = ['e', 'a', 'u', 'o', 'i']
# sort the vowels
vowels.sort()
# print vowels
print('Sorted list:', vowels)
Example 2: check if list is in ascending order python
n = list(map(int, input().split())) #assign list values from input
if sorted(n) == n: #for descending, use sorted(n, reverse=True)
print("Yes")
else:
print("No")
#Hope this helps:)