Why is it not printing the updated word?


#1

Question

Why is it not printing the updated word?

Answer

If you’re still printing the original variable, then you should expect to see the original input string printed to the console. To see the string we’ve made some changes to by now, we need to print the variable we want to see displayed to the screen. For example:

first_string = “My initial STRING!”
new_string = first_string.lower() + “ Altered!”
print first_string

In the code above, we made a string, changed it, but are still printing the first string we made. To see the changed string, we’d print new_string.


FAQ: Learn Python - Pyglatin - Move it on Back