how can I write a program to rearrange the words in a sentence in alphabetical order | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can I write a program to rearrange the words in a sentence in alphabetical order

14th Nov 2016, 2:18 PM
nayana john
nayana john - avatar
2 Answers
+ 2
Have you tried these? >>> help("str.split") Help on method_descriptor in str: str.split = split(...) S.split([sep[, maxsplit]]) -> list of strings Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result. >>> help("list.sort") Help on method_descriptor in list: list.sort = sort(...) L.sort(key=None, reverse=False) -- stable sort *IN PLACE*
14th Nov 2016, 3:03 PM
Kirk Schafer
Kirk Schafer - avatar
0
thanks
15th Nov 2016, 12:28 AM
nayana john
nayana john - avatar