+ 2
Sort
How do I make it so it sorts an integer https://code.sololearn.com/cBE6vdfIAFwq/?ref=app
6 Answers
+ 3
So, if your input is all on one line seperated by a space, as shown, then you can split() the input into a list of number strings. You can then map this list using the int function to convert the strings to numbers. Then convert back the map object back to a list, so you now have a list of the numbers that were input as integers instead of strings. Then you can sort() as before.
sorter = list(map(int, input().split()))
sorter.sort()
print(sorter)
+ 4
What do you want ask properly there is no list of variable to short and also 1 string or int can't sort.
+ 1
This question is a bit vague. Please describe better what you are trying to accomplish. Give examples of the input(s) the expected action(s) and an example of the expected output(s).
+ 1
Thanks! ChaoticDawg
0
I want it so when I type in multiple numbers like â1 3 5 2â it sorts it so it is now â1 2 3 5â ChaoticDawg and Abu Habban