I want pop out all the large values and its keys in a dictionary, and keep the smallest. Here is the part of my program
for key,value in dictionary.items():
Record the key during the loop and then do dictionary.pop(key) when loop is done. Like this:
for key,value in dictionary.items(): for key1, value1 in dictionary.items(): if key1!= key and value > value1: storedvalue = key dictionary.pop(key)