Strings¶
Strings in Python are immutable sequences of characters. Almost every operation that modifies a string creates a new string.
So the time complexity of string most operations is O(n) where n is the length of the string. This includes concatenation, slicing, and other operations that create new strings.
Defining a string
Trying to concatenate a string with an integer
f-strings
.format
Checking if a string is numeric
Splitting a string
Joining a text
Accessing characters in a string
String are immutable