I am trying to make a for loop which adds new entries to my dictionary which should be in the format of {1:0.5, 2:0.5, 3:0.5….}
I need to make it do this 200 times. But for some reason my code prints out an empty dictionary:
initial_dict = {}
for i in initial_dict.copy():
if len(i) < 200:
initial_dict.update({i: 0.5})
print initial_dict
Any ideas?
or the shorter form using dict comprehensions: