+ 2
Sort
How do I make it so it sorts an integer https://code.sololearn.com/cBE6vdfIAFwq/?ref=app
5 ответов
+ 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