我仍然不太熟悉编程语言,我正在努力理解返回值的 low_price 和返回(显然)一个对象的 high_price 之间的区别。有人能解释一下为什么他们有不同的结构吗?两者都是字典。high_price 正在通过一个函数。希望这是有道理的。如果缩进不正确,我深表歉意,我仍在努力在网站上做到这一点!
Output
{0: {...}}
({0: {...}}, 99.9969999999999)
def agregate_freq(freq, high_price,low_price):
if mynumber >high_price[0]: #new one
high_price[0] = mynumber
#if mynumber <low_price[0]: #new one
# low_price[0] = mynumber
print(high_price[0])
return (high_price)
if mynumber <low_price[0]: #new one
low_price[0] = mynumber
high_price[0] = agregate_freq(0,high_price,low_price)
print (high_price[0],low_price[0])