# 5.- match_ends
# Given a list of strings, return the count of the number of
# strings where the string length is 2 or more and the first
# and last chars of the string are the same.
# Note: python does not have a ++ operator, but += works.
# For example, the result of n = n + 1 can be also achieved by n += 1.
def match_ends(words):
# +++your code here+++
if len(words)>=2:
return words[0]and words[-1:]==words[-1:]
words+=words
你们认为我做错了什么?我该如何改进?在
结果如下:
^{pr2}$
这应该对你有用:)
如果你想让它更像Python,你可以:
^{pr2}$更精简的方法:
相关问题 更多 >
编程相关推荐