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 | First N letters string construction
- Python | Insert value after each k letters in given list of string
- Python | Ways to split a string in different ways
- Python | Ways to sort a zipped list by values
- Python | Ways to sort list of float values
- Ways to sort list of dictionaries by values in Python – Using itemgetter
- Ways to sort list of dictionaries by values in Python - Using lambda function
- Python | Ways to sort list of strings in case-insensitive manner
- Reverse string in Python (5 different ways)
- Python | Ways to check string contain all same characters
- Python | Ways to concatenate boolean to string
- Find length of a string in python (4 ways)
- Ways to remove i'th character from string in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.