Let’s say I have this string:
"ac"
How can I transform it into:
"aac"
Let’s say I have this string:
"ac"
How can I transform it into:
"aac"
@jaccobtw, you can’t do it, since, in Python, strings are immutable, meaning that they cannot be changed.
However, you can make a new string, by using the + operator. It works with strings by joining strings together, a process called concatenation.
my_str = "ac"
my_new_str = my_str + "c"
print(my_str)
print(my_new_str)
Output:
ac # original string unchanged
acc # new string