s
in change(s)
is the name associated with the word
value when calling change(word)
.
On line s = s + "!"
you bind s
to a new line, which is created by concatenating the value bound to s
and !
doing nothing for word
.
It’s also better not to have side effects, even if it’s possible, so it’s better to return a new value.
def change(s): return s + '!'
source share