EDIT: Thank you for your kind replies on how to accomplish what I am trying to do, but the question is about WHY range().append() returns None if you try it in one step, and WHY it works if you two-step the procedure.
Im trying to create a numerical list but with a twist. I don't want a couple of numbers at the beggining of my list:
mlist = [0, 5, 6, 7, ...]
So i thought to do the following:
mlist = range(5,n+1).append(0)
but silently fails because type(mlist) afterwards equals to NoneType ?! (related: type(range(5,10) evaluates to list Type)
If i try to do that in two steps eg:
>>> mlist = range(5,10)
#and then
>>> mlist.append(0)
>>> mlist
[5, 6, 7, 8, 9, 10, 0]
What's happening?
mlistof[5, 6, 7, 8, 9, 0], and the spacing is wrong. Please copy and paste transcripts -- it's too easy to make mistakes otherwise. - DSM.append()alters the list in place. And that also makes you question a duplicate. - Martijn Pieters♦