# 判断能否摆下组件的贴墙边 def canMathc(wallLength,moduleLengths): moduleTotalLength = 0; for item in moduleLengths: moduleTotalLength = moduleTotalLength + item if(moduleTotalLength <= wallLength): return 1 else: return 0 matchResult = canMathc(3,(1,1,2)) print(matchResult)