Python: List creation by multiplication operator time complexity

Solution 1:

The former is O(n), due to the use of PyList_New() with a known size. The latter is slightly worse than O(n), due to the need to resize the list after several appends.