How to sort the letters in a string alphabetically in Python without using join()? Using join() we can do this:
def sort_string(a)
return ''.join(sorted(a))
Is there a way to sort string without using join()?
How to sort the letters in a string alphabetically in Python without using join()? Using join() we can do this:
def sort_string(a)
return ''.join(sorted(a))
Is there a way to sort string without using join()?
Your solution is correct as strings are immutable in python. So, it's impossible to change (in your case - sort) an existing string. You have to create new one (you do it with join() call).
Also, good notes about sorting letters in string in python can be found here: How to sort the letters in a string alphabetically in Python