Discuss / Python / 测试成功

测试成功

Topic source

筱枫_Edward

#1 Created at ... [Delete] [Delete and Lock User]

if len(s)>0: if s[0]!=" " and s[-1]!=" ": return s elif s[0]==" ": s=s[1:] return trim(s) elif s[-1]==" ": s=s[:-1] return trim(s) else: return s

筱枫_Edward

#2 Created at ... [Delete] [Delete and Lock User]

用递归来做的核心就一定要在第一句把满足所有条件的结果返回。而不仅仅是一边满足。


  • 1

Reply