双层for列表生成式疑问
print [x1*x2 for x1 in range(1,100,2) for x2 in range(2,100,2)]
打印不出来:[1*2,3*4,5*6,...]
却打印出:[2,4,6,8,10,12............]
然而:
print [x1 for x1 in range(1,100,2)] 是:[1,3,5,7,9....]
print [x1 for x1 in range(1,100,2)] 是:[2,4,6,8,10....]
按照这个值,x1*x2就是:[1*2,3*4,5*6,...]
对:print [x1*x2 for x1 in range(1,100,2) for x2 in range(2,100,2)] 的最终结果表示疑惑。