Dictionary - add_ten activity

SO this code works perfectly: ( the goal is to add 10 to each value in the dic.)
for key in my_dictionary.keys():
my_dictionary[key]+= 10
return my_dictionary

BUT WHY DOES THIS NOT WORK OUT:
for value in my_dictionary.values():
value += 10
return my_dictionary

THANK YOU FOR YOUR HELP!- ISNT my_dictionary[key] same as value???

How are these codes different? one works but the other doesnt!!
for keys,values in my_dictionary.items():
if keys in my_dictionary.values():
same_list.append(values)
return same_list
VERSUS

for keys,values in my_dictionary.items():
if values in my_dictionary.keys():
same_list.append(values)
return same_list

PyObject* PyDict_Values (PyObject *p )

Return value: New reference.

Return a PyListObject containing all the values from the dictionary p .
Source Link: Dictionary Objects — Python 3.9.1 documentation

.values() returns an object containing a list of the values of a given dictionary. It’s maybe useful to note that the object is not the dictionary itself, but a new representation. So when you write value += 10 you are only changing the value of the new object instance (not the original dictionary).

For your second question I can’t tell exactly what’s going on because of indentation. You can format your code by pressing the </> button and pasting in between the tick marks that appear after.