def headAndFoot(s):
"""precondition: s is a string containing lower-case words and spaces
The string s contains no non-alpha characters.
postcondition: For each word, capitalize the first and last letter.
If a word is one letter, just capitalize it. """
last = len(s) - 1
x = s.title()
y = x.split()
return y
需要做什麼修改?將字符串中每個單詞的最後一個字母大寫
爲什麼要拆分字符串?你怎麼沒有預覽這個問題,以確保人們可以閱讀它? –
你需要展示一些更多的努力,你能解釋一下你打算怎麼做,爲什麼你認爲它應該工作?然後我們可以幫助你理解你的錯誤並引導你。 – Simon