【发布时间】:2022-11-02 09:47:08
【问题描述】:
首先感谢您提供这个向大家学习的绝佳空间,我有以下问题。我创建了一个从多个 API 导入数据的代码,它围绕数据执行各种统计操作。并返回 1 个结果编号,有助于查看模型是否正确。 代码围绕 4 个(或更多)静态变量构建。我想要的是为每个变量创建一个数字范围并测试代码中所有可能的组合,返回前 10 个最高结果数字。 它看起来像这样:
#I would want to test i.e. variable_1 in a range from (-0.004 to 0.004 at 0.001 increments), the same for the other variables until I can get the top 10 highest result_number
variable_1 = 0.004
variable_2 = 0.005
variable_3 = 30
result_number = 0
def my_code():
global variable_1, variable_2, variable_3
#perform all the operations utilizing the variables
return result_number
请让我知道是否清楚,或者您是否知道如何攻击它。 谢谢你!!
我是 Python 新手,所以我仍在尝试找出如何循环并记录最高数字。代码相当长,所以模拟需要几个小时
【问题讨论】:
-
这回答了你的问题了吗? How do I use a decimal step value for range()?
标签: python