Hello I am trying to update a list of order numbers and their times. For example, I have four lists that look like this
OrderNum1 = ['1','6','3']
originaltime = ['12AM','5AM','7AM']
OrderNum2 = ['1','3']
newtime = ['2AM','2AM']
The Goal is to replace the values of 'originaltime' with the values of 'newtime' if/when the order numbers match.
I was previously using this
for i,(a,b) in enumerate(zip(OrderNum1,OrderNum2)):
if a == b:
originaltime[i] = newtime[i]
But that will not update the time of ordernum 3 because the index does not match. The desired outcome is:
print(originaltime)
['2AM', '5AM', '2AM']