Message from Python discussions
December 2018
— Hmm
I just tried the previous solution and it gives me a list of 4 numbers while the expected result is the higher value of the 4 lists in each iteration is like if i have 4 lists:
list1=[1,2,3,4,5,6,7,8,9]
list2=[8,7,6,5,4,3,2,1,0]
list3=[10,11,1,4,6,0,3,1]
list4=[100,5,2,7,1,0,2,4]
Output of higher highs:
higherhighs[100,11,6,7,6,...]
hope i explain correctly
— So the output being the higher value betwen each single iteration of the 4 lists
— Ahh I see
— Yes this is how it should be the output
— Trying to figure out solutions for this excercice but u guys were the ones that pressed the correct key
— Maybe i am just too tired 2 am here
— Look at what zip() does
— And then use max()
— Ok
—
hsopens = []
hscloses = []
hshighs = []
hshighslows = zip(opens,closes,highs,lows)
hsopens=[(opens[i-1] + closes[i-1])/2 for i, x in enumerate(opens) if i > 0]
hscloses=[(opens[i] + highs[i] + lows[i] + closes[i])/4 for i, x in enumerate(opens) if i > 0]
hshighs = [max(a) for a in hshighslows]
— Yup