Note: The string s itself is not modified. Python string methods usually return a new string.
When you type .upper with a variable, Python analyzes the variable, if it is in lower case characters, it searches for the corresponding upper case letters . It does not change your original variable. You can check it by executing "a" again , it will return "hello world" again.
.upper or .lower statements return The upper/lower case version of your variable leaving the variable intact.
I hope it answers your question.