What does it mean that strings are immutable?

Python data types and strings · Freshers

Model answer

You cannot change a string in place. Operations like replace or upper return a new string. To build a string from many parts, collect them in a list and use ''.join(parts), which is faster than repeated concatenation in a loop.

Learn this topic

Variables, Numbers, Text and input() in Python in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions