Creating and extending a list in one line
python, python-3.x
Solution
You can use this one liner:
mylist = [7] + list(range(9,12))
It returns the desired list:
[7, 9, 10, 11]
Problem
``` mylist=[] mylist.append(7) mylist.extend(range(9,12)) ``` can such a thing be done in a single line in python3? I feel it should be trivial, but for some reason I can't recall nor find how to do that.