The argument is entered as a list (ie. [4,5,6]). But how can I get the output as a list and not just integers
<p>The output I was getting was just integers (ie. 2,6,9). Desired output was a list (ie. [2,6,9] ). </p>

<pre><code>def multiplyNums(aList):
    for (i,j) in enumerate(aList):
        newList = []
        if i &lt; (len(aList)-1):
            newList = (aList[i] * aList[i+1])
            x = print(newList,end=',')
        else:
            newList = (aList[i] * aList[i])
            x = print(newList)
    return x
</code></pre>

<p>A cleaner way to do this would be :</p>

<pre><code>def multiplySuccessor(aList):
    newList = []
    for i in range(len(aList)-1):
        newList.append(aList[i] * aList[i+1])
    newList.append(aList[len(aList)-1]**2)
    return newList
</code></pre>

python list