擅长:python、mysql、java
<p>如果您让<code>randomNumbers()</code>函数像这样返回,您可以避免全局状态。你知道吗</p>
<pre><code>def main():
# calculate something
num1, num2 = randomNumbers()
# calculate something else
def randomNumbers():
# calculate something
return num1, num2
</code></pre>
<p>如果您想查找更多信息或文档,将两个值组合成一个值的方式称为“元组”。你知道吗</p>