Do you want to improve this question?Edit your post to clarify the issue you are trying to resolve by adding details.
Closed 2 years ago.
Two years agoThe question is, "Define a function that returns a string of hyphenated words and hyphenated words."
Examples of implementation include:
def hyphen_sorted(connectedstring):
print(hyphen_sorted('red-green-blue')
Examples of execution
'blue-green-red'
I would like to make it
Split
Sorted
Join
I think I can manage it if I combine them around
Split is used to break down strings.
In this case, we break down the red-green-blue with - and break it apart.
Then sort by Sorted and join together.
In a stack overflow, the answer to the homework itself is
I don't think so well.
Try writing your own program based on the hint and if it doesn't work well
If you ask again, you will be able to answer.
It's not very simple, but I wrote it down.
How about this?
def hyphen_sorted(connectedstring):
string_list = connected string.split('-')
US>string_list.sort()
return'-'.join(string_list)
print(hyphen_sorted('red-green-blue'))
© 2024 OneMinuteCode. All rights reserved.