python dictionary object vs value -
i still not quite familiar programmation language , struggling understand difference between low_price returns value , high_price returns (apparently) object. can explain me why have different structure? both dictionary. high_price getting through function. hope makes sense. apologies if indentation isnt correct, still struggling right website aswell!
output {0: {...}} ({0: {...}}, 99.9969999999999) def agregate_freq(freq, high_price,low_price): if mynumber >high_price[0]: #new 1 high_price[0] = mynumber #if mynumber <low_price[0]: #new 1 # low_price[0] = mynumber print(high_price[0]) return (high_price) if mynumber <low_price[0]: #new 1 low_price[0] = mynumber high_price[0] = agregate_freq(0,high_price,low_price) print (high_price[0],low_price[0])
return (high_price)
returns value of expression high_price
, not tuple expected. (high_price[0],low_price[0])
tuple. if want single element tuple, put comma after high_price
; return (high_price,)
.
this reason why there difference between output seen.
Comments
Post a Comment