0
Debugging python code?
I need help debugging this code , All the info is here: https://code.sololearn.com/c0sWC7RbU84N/?ref=app Goodluck
2 Réponses
+ 2
Since you want "-42 9" (largest then smallest), you need the iterable to be sorted in descending order.
numbers = list( map( int, numbers.split() ) ) # convert all split results to `int`
numbers.sort( reverse = True ) # sort in descending order
+ 2
sort method sorts the string alphabetically. Since you are using numbers as string you can use key as int, means:
numbers.sort(key=int)
It will convert string to integers and then compare it to others