完成compute函数,使得它可以返回任意长度字符串列表中每个字符串的长度,结果保存在一个列表中。
例如:compute([‘Bill’,‘Gates’])=[4,4]
def compute(lis):
print(lis)
ans = list(map(len,lis))
return ans
完成compute函数,使得它可以返回任意长度字符串列表中每个字符串的长度,结果保存在一个列表中。
例如:compute([‘Bill’,‘Gates’])=[4,4]
def compute(lis):
print(lis)
ans = list(map(len,lis))
return ans