+ 2
How can I make an input string into a list to sort it alphabetically
Example - string :- sort in alphabetical order Output- alphabetical in order sort
9 odpowiedzi
+ 4
list(input()) will split the input into a list of alphabets. Then sort() will sort it for you.
+ 4
i think that a more clear sample for input and output would be helpful.
Input = 'sololearn'
output = 'aellnoors'
if this is what you want to get, you can do this:
(1) use list(input) to create a list with all individual characters of the input string
(2) sort this list
(3) ''.join() the list to a string
(4) printbthe string
+ 3
input().split()
+ 3
+ 2
Yup that split() methods converts a string into list based on argument provided to it ,
+ 1
I know how to sort list but don't know how to make input string into list
+ 1
Ok I will try
+ 1
Actually I wanted to sort a list but still keep it as a list (a,b,c)😅 but still thank you it might help me in the future
+ 1
Ashkey has already solved it.. But I just want to help
https://code.sololearn.com/cGEuDh8vMkDz/?ref=app