【发布时间】:2019-04-02 19:20:46
【问题描述】:
我有一个函数可以简化为:
def do_stuff(a,b,c):
a = a*2
b = b*3
c = c
return a, b, c
给定初始条件:a = 2, b = 3, c = 1
我想迭代函数直到 a 等于 64
我正在尝试使用 while 循环,例如
while True:
new_a, new_b, new_c = do_stuff(a, b, c)
... Here is where I am confused ...
if new_a = 64:
return False
我如何声明函数的初始值,然后让它在下一次迭代中使用自己的输出作为输入。
感谢任何帮助!
【问题讨论】:
标签: python python-3.x loops recursion