What's the point of creating an empty list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the point of creating an empty list?

6th Sep 2016, 6:34 PM
DELETED
3 Answers
+ 3
simple. for future uses within functions.
6th Sep 2016, 6:46 PM
sundar
sundar - avatar
+ 2
it is a good programming prctice to initialize your variables before using them (this rule applies for languages like C and C++). However, in case of python the variable has four attributes (value, type, id, name) and all gets assigned in the declaration statement, but you may want to start with an empty list and append elements to it later or make it as a placeholder that helps you to remember that you want a list
6th Sep 2016, 9:39 PM
Alansary
+ 1
you can save something with it,such as the answer you got.
8th Sep 2016, 6:22 AM
赵潜
赵潜 - avatar