I have following list, where I try to change all first characters of the keys to upper case with this code:
listOfNames = {
    'tim':1,
    'frank':1
}
for name in listOfNames.keys():
    name = name.capitalize()
    print(name)
I noticed, that when I leave out the assignment of the variable name like follows:
for name in listOfNames.keys():
    name.capitalize()
    print(name)
It prints out all the keys without changing them. Now if I understood it correctly, name is only a copy of the key. But I run the method capitalize on that copy. Why doesnt it return the key with upper case when I leave out name = name.capitalize()?
 
    