我是python的新手,我需要如何从函数调用中获取返回值。 我试图做这显然是错误的我需要将返回值分配给所提到的变量,我不能改变我如何从函数返回值,因为这是问题中需要的。从元组元组中获取值
((cross_low,cross_high),cross_sum)=find_maximum_crossing_subarray(A,low,mid,high)
我从find_maximum_crossing_subarray
函数返回这种类型的值:
tup=(max_left,max_right)
tup1=(tup,left_sum+right_sum)
return tup1
什么是left_sum和right_sum的价值?当我写了一些测试代码,其中max_left,max_right,left_sum和right_sum是浮动的,我没有错误,它一切正常。当你运行代码时会发生什么?你有错误吗? –
你能提供一些样本数据,一些你期望的输入和输出。尤其是输出格式? – MooingRawr
请将您的代码包装在[mcve]中。可能是某处的拼写错误 –