Use extend()
:
>>> x = [1, 2, 3, 4]
>>> x.extend([5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
>>> x
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
Instead of typing out the numbers from 5 through 15, use a range()
:
>>> x = [1, 2, 3, 4]
>>> x.extend(range(5, 15))
>>> x
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
The first edit that you made was correct, since you can only append
one item at a time, not a tuple
like (5, 6, 7, 8, 9, 10, 11, 12, 13, 14)