deleting entries in a dictionary based on a condition
The usual way is to create a new dictionary containing only the items you want to keep: new_data = {k: v for k, v in data.items() if v[0] <= 30} If you need to change the original dictionary in place, you can use a for-loop: for k, v in list(data.items()): if v[0] > 30: del … Read more