旧书店要给书架做标签。书名有的全是大写,有的前后多了空格。写 shelf_label(book):去掉两头的空格,再让每个词首字母大写、其余小写。空字符串返回空字符串。
shelf_label(" the little prince ")→'The Little Prince'shelf_label("MOBY DICK")→'Moby Dick'def shelf_label(book):
# 在这里写:先 strip() 再 title(),把结果返回
return book
写好了先点「运行」试试示例,没问题再点「提交」。