My assignment is this:
Let L be a list of non-negative integers. Write an expression that replaces the centermost element of L with that many copies of 0. Note that "centermost" here is defined the usual way for a list of odd length, but may seem a bit unusual for a list of even length. So, for example, if L = [1, 2, 3, 4, 5], the modified value of L will be [1, 2, 0, 0, 0, 4, 5], but if L = [1, 2, 0, 3], the modified value would be [1, 2, 3], as the 0 – here the centermost element of an even-length list – would be replaced with 0 copies of 0.
The expression I came up with is
L[len(L)/2] = [0] * L[(len(L)/2)]
and output for L = [1, 2, 3, 4, 5] is
[1, 2, [0, 0, 0], 4, 5]
I need to eliminate that inner list element such that the zeroes are part of the outer list. We are restricted to a single line and no for/while loops.
 
     
     
    