Given a string of letters, write a python program to sort the given string in an alphabetical order.
Input : PYTHON Output : HNOPTY Input : Geeks Output : eeGks
When string is in same case –
Method #1 : Using
Method #2 : Using
Method #3 : Using
Another alternative is to use reduce() method. It applies a join function on the sorted list using ‘+’ operator.
When string is in different cases –
- Python | Sort the list alphabetically in a dictionary
- Python | Sort the items alphabetically from given dictionary
- Python program to sort a list of tuples alphabetically
- Python | Insert value after each k letters in given list of string
- Python | First N letters string construction
- Python program to verify that a string only contains letters, numbers, underscores and dashes
- Regex in Python to put spaces between words starting with capital letters
- Python regex to find sequences of one upper case letter followed by lower case letters
- Python | Remove all characters except letters and numbers
- Python | Ways to split a string in different ways
- MoviePy – Text with moving Letters
- Ways to sort list of dictionaries by values in Python - Using lambda function
- Ways to sort list of dictionaries by values in Python – Using itemgetter
- Python | Ways to sort a zipped list by values
- Python | Ways to sort list of float values
- Python | Ways to sort list of strings in case-insensitive manner
- Python Program for Odd-Even Sort / Brick Sort
- Python | Sort each String in String list
- Add elements in start to sort the array | Variation of Stalin Sort
- Reverse string in Python (5 different ways)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.