假如有一个函数,实现返回两个数中的较大值: def my_max(x,y): m = x if x>y else y return mbigger = my_max(10,20)print(bigger) 之前我们要把结果return回来,可是我们为什么要把结果返回?如果我们不返回m,直接在程序中打印,行不行? 来看结果: >>> def my_max(x,y): ... m = x if x>y else y ... >>> my_max(10,20) &…
十三. Python基础(13)--生成器进阶 1 ● send()方法 generator.send(value) Resumes the execution, and "sends" a argument which becomes the result of the current yield expression in the generator function. The send() method, like __next__(), returns the next v…