This can simply be done as
mylist = ["var"] + [None] * 5
The Reason,
["var"].extend([None for cnt in range(5)])
will not work, because extends changes the list in-place, but does not return the original list. You could have done
mylist = ["var"]
mylist.extend([None for cnt in range(5)])
Your second attempt
list_2=["var",None for cnt in range(5)]
is also not correct
- Because its a generator expression without parenthesis.
- Even if it would have worked, it would add what ever you get as the second item in the list