# def generator():
# print(123)
# num = yield 1
# print('$$$$$$',num)
# print(456)
# yield 2
# print(789)
#
# g = generator()
# ret = g.__next__()
# print('***',ret)
# ret = g.send("hello")
# print("***", ret)
# send 获取下一个值的效果和next基本一致
# send 只是在上一个的值的位置发送一个值
#使用send的注意事项:
#第一次使用生成器的时候,是用next获取下一个值
#最后一个yield不能接收外部的值v看不见
#获取移动平均值
# avg = sum /count
# def average():
# sum = 0
# count = 0
# avg = 0
# while True:
# # num = yield
# num = yield avg
# sum += num
# count += 1
# avg = sum / count
#
#
# avg_g = average()
# avg_g.__next__()
# avgl = avg_g.send(10)
# avgl = avg_g.send(20)
# avgl = avg_g.send(30)
# print(avgl)
def generator():
a = "abcde"
b = "12345"
yield from a
yield from b
g = generator()
for i in g :
print(i)
#列表推导式
# egg_list = ["鸡蛋%s" % i for i in range(10)]
# print(egg_list)
#
# print([i*i for i in range(10)])
# 生成器表达式
# g = (i for i in range(10))
# # print(g)
# for i in g:
# print(i)
#生成器表达式()