If I have a dictionary with each key having a list of values for example:
my_dict={'key1':[1, 6, 7, -9], 'key2':[2, 5, 10, -5,], 'key3':[-8, 1, -2, 6]}
And I want to create a loop statement to go through each value within the lists and change the value within my dictionary to 0 for each negative value. I can create a loop statement to go through each value and check if the value is negative but I can't figure out how to amend the dictionary directly:
for keys, values in my_dict.items():
for value in values:
if value < 0:
value=0
How to I alter that last line (or do I have to change more lines) to be able to amend my dictionary directly to replace the negative values with 0?
Thanks in advance