0

list

What does list[None]*5 means

11th Apr 2020, 6:21 AM
Shivam
2 ответов
+ 4
The way you wrote it in your question: list[None]*5 is not valid. But you can define a list like this: mylist = [None]*5 It is the same as adding 5 lists, each containing the value None. mylist = [None] + [None] + [None] + [None] + [None] Ultimately the result will be: mylist = [None, None, None, None, None]
11th Apr 2020, 6:35 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Here are two references in regards to None It is like NIL or NULL in other languages. https://stackoverflow.com/a/36928646/7218253 https://docs.python.org/2/library/constants.html#None
11th Apr 2020, 6:28 AM
BroFar
BroFar - avatar