+ 1
how can I write a program to rearrange the words in a sentence in alphabetical order
2 Antworten
+ 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*
0
thanks