19 Jan
2020
19 Jan
'20
5:44 a.m.
This is more of a doubt than a new idea. Python has always worked intuitively but this was a bummer. A list has an append method. So I can do list.append(value). I tried doing list(range(10)).append(10) and it returns None. I'd usually assume list(range(10)) returns a list, to which I can append whatever I want. I tried this with List comprehension also. Doesn't work there either. Why doesn't this work? Moreover, shouldn't it work? How do I add that feature in Python?