这是我的代码
def getNegativesList(postivesAndNegativeslist):
if postivesAndNegativeslist = None:
return None
elif len(postivesAndNegativeslist) = 0:
return None
negativesList = []
for val in negativesList:
if val<0:
return negativesList.append(val)
print(getNegativesList(2,-3,-5,10,-1)
答案 0 :(得分:-1)
代码不需要解释。
def getNegativesList(postivesAndNegativeslist):
if postivesAndNegativeslist is None:
return None
elif len(postivesAndNegativeslist) == 0:
return None
negativesList = []
for val in postivesAndNegativeslist:
if val<0:
negativesList.append(val)
return negativesList
print(getNegativesList([2,-3,-5,10,-1]))