inserting characters at the start and end of a string

python

Solution

Strings are immutable so you can't insert characters into an existing string. You have to create a new string. You can use string concatenation to do what you want:

yourstring = "L" + yourstring + "LL"

Note that you can also create a string with n `L`s by using multiplication:

m = 1
n = 2
yourstring = ("L" * m) + yourstring + ("L" * n)

Problem

I am new and trying to find a way to insert a number of L's at the beginning and end of a string. So if I have a string which says "where did I put my cupcake this morning" And I want to insert 1 L at the start and 2 L's at the end, so it looks like: "Lwhere did I put my cupcake this morningLL" How do I do this. thank you

Original source