在条件定义之前开始Python'while'循环
- 论坛
- 在条件定义之前开始Python'while'循环
18 浏览
在条件定义之前开始Python'while'循环
这个问题已经在这里有了答案:
我有一段代码,它执行一个函数,然后根据输出决定是否重新运行:
while (function_output) > tolerance: function_output = function(x)
问题是,while循环不会开始直到 \"function_output\" 被定义 - 但它是在循环中定义的。目前我有:
function_output = function(x) while (function_output) > tolerance: function_output = function(x)
但是有没有一种方法可以让这个循环在不必先迭代一次函数的情况下开始?
admin 更改状态以发布 2023年5月19日