怎么改????,谢谢
def func(listinfo):try:
result = filter(lambda k: k<100 and k%2==0, listinfo)
except Exception as err:
return err
else:
return list(result)
listinfo =
assert type(func(listinfo)) == list
assert func(listinfo) ==
要返回
Traceback (most recent call last):
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python38/1.py", line 10, in <module>
assert type(func(listinfo)) == list
AssertionError
怎么改????,谢谢
参考代码:
def func(listinfo):
try:
result = filter(lambda k: k<100 and k%2==0, listinfo)
except Exception as err:
return err
else:
print(list(result))
return False
listinfo =
assert func(listinfo) Traceback (most recent call last):
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python38/1.py", line 11, in <module>
assert func(listinfo)
AssertionError def func(listinfo):
try:
result = filter(lambda k: k<100 and k%2==0, listinfo)
except Exception as err:
return err
else:
print(list(result))
return True
listinfo =
assert func(listinfo) 谢谢啦
页:
[1]