Unexpected results with for loop and string manipulation in Python 3.11
I'm learning this framework and I've tried everything I can think of but I'm deploying to production and I'm sure I'm missing something obvious here, but I'm working with a question where a simple for loop that iterates over a list of strings is not yielding the expected results when I attempt to modify the strings. My goal is to convert each string in the list to uppercase, but it seems that the loop is affecting the original list. Here's the code snippet I'm using: ```python words = ['hello', 'world', 'python'] for word in words: word.upper() print(word) # This prints the original string ``` I expected the output to show the uppercase versions of the strings, but the original list remains unchanged, which leads me to believe that I'm not assigning the modified strings back to the list. I've tried several variations, including using list comprehensions like this: ```python words = [word.upper() for word in words] ``` However, I'm confused because while this works, it creates a new list rather than modifying the original one. Is there a way to modify the original list in-place while still using a loop? Or am I simply missing the right approach to achieve my goal? Any insights would be greatly appreciated! My development environment is macOS. Thanks in advance! Any ideas how to fix this? I'm developing on Debian with Python. The project is a desktop app built with Python. I'd be grateful for any help.