6. 简单推导 列表推导,是一种从其他列表创建列表的方式,其原理类似于for循环. list1 = [x * x for x in range(10)] print(list1) 结果: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] list2 = [x * x for x in range(10) if x % 3 == 0] print(list2) 结果: [0, 9, 36, 81] list3 = [(x,y) for x in range(3) for y…