Your array contains pointers to the strings. In your for-loop, fruit is just another pointer to the corresponding string (it is a copy of the original pointer, this is called 'passing by value'). So, although you change that fruit-pointer, the original pointer in your array (pointing to "bananas") remains unchanged. Can you now explain why text does get changed?
There are three kinds of actuaries: those who can count, and those who can't.
Sorry, what I meant was that the list is mutable, since that is what I was changing. The string was meant to be totally replaced with the line: fruit = fruit.replace(substring, "alloon")
I didn't really understand your explanation but it did help me see that I never actually touched the list. I would have said I changed a copy of one of the list's values, but I'm sure that's not correct either. My solution would be: