我对编程语言还不是很熟悉,我很努力去理解返回值的low_price和返回(显然)对象的high_price之间的区别。有人能解释我为什么他们有不同的结构吗? 两者都是字典。 high_price正在通过一项功能。希望它是有道理的。道歉,如果缩进是不正确的,我仍然努力得到这个权利与网站也!python字典对象vs值
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])