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 items alphabetically from given dictionary
- Python | Sort the list alphabetically in a 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)
- Find length of a string in python (4 ways)
- Python | Ways to check if given string contains only letter
- Python | Ways to find all permutation of a string
- 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 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.