I have a list that holds x values called "states" which I use to initialize a dictionary.
states_trans_prob = {states.index(s): {0: [], 1:[], 3:[], 4:[], 5:[], 6:[], 7:[], 8:[], 9:[]} for s in states}
As shown, the inner dictionary has 9 keys. I have another dictionary, called "actions" that has the same number of keys, therefore how can I intialize the dictionary instead of specifying it as shown above?
CodePudding user response:
states_trans_prob = {states.index(s): {key: [] for key in actions.keys()} for s in states}