1for n in range(20): 2 print('testing dict with {} items'.format(n)) 3 for i in range(n): 4 # create dict 5 d = dict() 6 for j in range(n): 7 d[str(j)] = j 8 print(len(d)) 9 10 # delete an item 11 del d[str(i)] 12 print(len(d)) 13 14 # check items 15 for j in range(n): 16 if str(j) in d: 17 if j == i: 18 print(j, 'in d, but it should not be') 19 else: 20 if j != i: 21 print(j, 'not in d, but it should be') 22