I have a list like this:
["*****", "*****"]
I want to insert the elements of another list to the middle of this list like this:
["*****", "abc", "ded", "*****"]
However, my attempt produces a list nested inside another list:
["*****", ["abc", "ded"], "*****"]
This is my code:
def addBorder(picture):
length_of_element = len(picture[0])
number_of_asterisks = length_of_element + 2
new_list = ['*' * number_of_asterisks for i in range(0, 2)]
new_list.insert(len(new_list)//2, [value for value in picture])
return new_list
I know that my code is good. I just want to know what tweaks I need to make.