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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -