0

if I initiate an empty dictionary {}, and I have two lists

var1 = ['trade1', 'trade2', 'trade3']

var2 = ['swap', 'bond', 'caplet']

how can I update the dictionary to make it as shown below:

{'trade1':swap, 'trade2':bond, 'trade3': caplet}

after that, I may get more combinations, such as: var 3 = ['trade4'], and var 4 = ['Irswap']

how to keep updating the above dict with those new trades to become:

{'trade1':swap, 'trade2':bond, 'trade3': caplet, 'trade4':Irswap, 'trade5':..}

finally, how to cache the loaded trades in this dict, for instance, if I got a new combination: trade1:xyz, because trade1 is already in this dict, it will not update this dict. Thank you!

0 Answers0