Alphabet Soup Python Programming
Problem:- Create a function that takes a string and returns a string with its letters in alphabetical order.
Examples:-
alphabet_soup("hello") ➞ "ehllo"
alphabet_soup("edabit") ➞ "abdeit"
alphabet_soup("hacker") ➞ "acehkr"
alphabet_soup("geek") ➞ "eegk"
alphabet_soup("javascript") ➞ "aacijprstv"
Notes:-
You can assume numbers and punctuation symbols won't be included in test cases. You'll only have to deal with a single word, alphabetic characters.
Code:-
(You can write direct one line code like : return "".join(sorted(txt))
Note:- Never miss indentation. If you are stuck check the python documentation. Suggestions and comments are always welcome.
Comments
Post a Comment