2.推导式: ????? 定义一个列表1-10(包含10), 所有的奇数的位置,都设为0,保留偶数 4.定义一个生成器:产生我们(red,blue,black), (L,M,S) ?? ?生成每个颜色对应的尺码 ?? ?要求:1.使用循环去访问 ?? ?????? 2.使用说的某一中方法
list_data = [i if i % 2 == 0 else 0 for i in range(1, 11)]
print(list_data)
print(80 * "🌙")
def test_func2():
color_tuple = ("red", "blue", "black")
size_tuple = ("L", "M", "S")
clothes_list = [(i, j) for i in color_tuple for j in size_tuple]
yield clothes_list
yield clothes_list
data = test_func2()
# print(data.send(None))
# print(next(data))
for i in data:
print(i)
?
?
?
?
|