[Solved] How to add items to dictionary in a for loop in Python?


A dictionary is a mapping from a key to a value. You need to provide a value, at the very least something that signifies ‘no value’:

tag_dic[i] = None

1

solved How to add items to dictionary in a for loop in Python?