为什么这里打印list_y == list(r)的结果为false
来源:12-3 map

weixin_慕勒4393907
2020-03-22
map
list_x = [1,2,3,4,5,6,7,8]
list_y = [1, 4, 9, 16, 25, 36, 49, 64]
def square(x):
return x * x
for x in list_x:
print(square(x))
r = map(square, list_x)
print®
print(list®)
print(list_y == list®)
写回答
1回答
-
weixin_慕勒4393907
提问者
2020-03-22
list_x = [1,2,3,4,5,6,7,8]
list_y = [1, 4, 9, 16, 25, 36, 49, 64]
def square(x):
return x * x
r = map(square, list_x)
print(r)
print(list(r))
print(list_y == list(r))
032021-10-14
相似问题