Can I change a single letter in a string?

Asked by emeka_nwankwo · 6 months ago

1 Answer

37
amorebise · 6 months ago Top Answer

Surprisingly, no. In Python, strings are immutable (unchangeable). If you want to change "Lagos" to "Magos", you have to create a brand new string.

It sounds annoying, but it actually helps keep the computer's memory safe and fast. You’ll learn tricks to 'rebuild' strings later on.

Log in to add a comment.