[Solved] Python – Question about initialising lists with [None] versus with just []


That is happening because append adds an element to the end of the list. Your list all ready has None in it so any elements you add are going to be put after it, like this [None, ...]. Therefore when you get the first element, it gives you None.

3

solved Python – Question about initialising lists with [None] versus with just []