# .生成器函数的几种使用方法:①生成器._next()②next(生成器)③send()配合上一个yield
# send的原理及使用方法。例:
# def chibaozi(name):
# print("等待中。。。。")
# baozi=yield
# print("%s开心的吃起了%s" %(name, baozi))
# def zaobaozi():
# qi=chibaozi("佩奇")
# qi.__next__()
# qi.send("大包子")#这里send返回的值传给了chibaozi函数中的yield,而yield在赋值给baozi
# zaobaozi()
所有用递归能解决的问题都可以用for来替代解决,比如下面例子,能同时被3和7整除的数的和# def zc(ks,js):
# fh=[]
# while ks <= js:
# if ks % 3 ==0 and ks % 7==0:
# fh.append(ks)
# ks +=1
# z=sum(fh)
# print("符合被3和被7整除的数有%s,它们的和是%s" % (fh, z))
#
# zc(1,100)
# def fuc(ks ,js ,a=0,b=0):
# if ks ==js:
# return a ,b
# if ks%3==0 and ks%7==0:
# a+=1
# b +=ks
# jg=fuc(ks+1,js,a,b )
# return jg
# zz=fuc(1,100)
# print(zz)
# def js(ks,js):
# a=0
# for i in range(ks,js):
# if i%3==0 and i%7==0:
# a +=i
# return a
# z=js(1,100)
# print(z)