Interested in the "total" output to reflect the count of new keys matching the criteria in the if statement. If you would also be able to provide instruction on how to show how many keys weren't returned as a result of the if statement that would be helpful.
d = {1:0.3246, 2:3.222, 3:3344, 2:0.3444, 5:1.09, 6:222.3}
for key in list(d)[:4]:
if key == 2:
continue
print(key, d[key])
keyresults = key
print('Total unique keys found:', keyresults)
Expected results:
1 0.3246 3 3344 5 1.09 Total unique keys found: 3 Total unique keys not found: 2
Actual results:
1 0.3246 3 3344 5 1.09 Total unique keys found: 5
Aucun commentaire:
Enregistrer un commentaire