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:


Output of higher highs:

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

Message permanent page

— 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]

Message permanent page

— Yup