I am attaching the code below, I know there are some ways to clean it up or make it more efficient and would appreciate those tips as well, but I am mainly just struggling figuring out why double digit numbers in the list are not being sorted accordingly. 23 is between 2 and 3 for example, single digits work fine. Thank you for your time.
## Creating a function that takes in two strings and returns a list in a specific orientation depending on what string is entered
## Couldn't figure out how to make double digits go in order
def sort_list(list, string):
if string == 'desc':
list = sorted(list.split(), reverse = True)
return list ## First section returns list in opposite order if 'desc'
elif string == 'asc':
list = sorted(list.split())
return list ## Second retuns list in ascending order if 'asc'
elif string == 'none':
list = list.split()
return list ## Third returns list in same order if 'none' is chosen
def main():
list = input('Please input numbers with spaces in between to create a list:\n')
string = input('Please enter what order you would like your list returned to you:\n')
print(sort_list(list,string))
main()