I messed up the valueShift and valuesSticks mixing up for sure
Thanks
That is amazing Jordan
Tried:
print valuesSticks
print valuesDailySticks
sumList = [(a or 0)+(b or 0) for a,b in zip(valuesSticks,valuesDailySticks)]
print sumList
output
[0, 30750, 50544, None, 83212, 50430, 0, 52615, 0, 0, 0, 0, 0, None, 68241, 0, 73622]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 30750, 50544, 0, 83212, 50430, 0, 52615, 0, 0, 0, 0, 0, 0, 68241, 0, 73622]
The ordering is preserved.
I donāt have to use enumerate to see the indexes of good and try to correlate them across the two lists of counters.
It is just like
base Path
Paths from list comprehension to get all the machines
list comprehension to read the values
repeat that for the daily
then just add them with the or
now I can write them with a list comprehension easy too
revised
print valuesSticks
print valuesDailySticks
sumList = [(a or 0)+(b or 0) for a,b in zip(valuesSticks,valuesDailySticks)]
print sumList
thisList=[]
for a,b in zip(valuesSticks,valuesDailySticks):
if a:
thisList.append(valueShift + valueDaily)
else:
thisList.append(valueDaily)
print 'here'
valuesSticks
valuesDailySticks
thisList
[0, 34440, 52650, None, 85227, 52890, 0, 55817, 0, 0, 0, 0, 0, None, 70575, 0, 76626]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 34440, 52650, 0, 85227, 52890, 0, 55817, 0, 0, 0, 0, 0, 0, 70575, 0, 76626]
here
[0, 34440, 52650, None, 85227, 52890, 0, 55817, 0, 0, 0, 0, 0, None, 70575, 0, 76626]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 75595, 75595, 0, 75595, 75595, 0, 75595, 0, 0, 0, 0, 0, 0, 75595, 0, 75595]
oh I see it, I needed to reinitialize thisList =[]