I want to add c
times b
integer to middle of the list.
Here my code:
listA.insert(int(len(listA)/2),b*c)
print("Your New List: ", listA)
When I change (b*c)
to ([b]*c)
it works but I will convert it integer later. Therefore, it must be formal form like [1,2,3,4,5]
not [1,2,[3],4,5]
. If we say listA = [1,2,3,4,5]
and let's suppose b = 2
and c = 3
I need to have [1,2,2,2,2,3,4,5]
. Also, I don't have permission to use loop.