s = 'this is the best'
words = s.split() # Split into list of each word
res = ''
for word in words:
word = word[::-1] # Reverse the word
word = word.capitalize() + ' ' # Capitalize and add empt space
res += word # Append the word to the output-string
print(res)
只要做:
使用^{} ,然后反转字符串,最后使用^{} :
输出
这里的其他答案也适用。但我认为这会更容易理解
相关问题 更多 >
编程相关推荐