+ 3

Could someone explain how can i use an empty list?

4th Aug 2016, 10:44 PM
Roberto Emmanuel Román Escobar
Roberto Emmanuel Román Escobar - avatar
5 Respuestas
+ 4
Okay...this question is crazy old and the OP's not active...so this "special-case" answer is for others. * You can use empty lists to persist data across function calls, as shown here: http://docs.python-guide.org/en/latest/writing/gotchas "Mutable Default Arguments" -When the Gotcha Isn't a Gotcha ...when you "exploit" or intend the function to maintain state between calls of a function ...such as a "caching function"
27th Jan 2017, 12:41 AM
Kirk Schafer
Kirk Schafer - avatar
+ 3
you introduce it like that >>>list =[] and it is used when you want to append some specific values into it. Hope i helped
5th Aug 2016, 2:59 PM
Slimani Mohammed
Slimani Mohammed - avatar
+ 3
Imagine you're going to the store. You take a sheet of paper and title it: Grocery List. That title, equates in code to your empty list. What you add or take from the list, from there, is up to you.
23rd Jan 2017, 2:09 AM
Samantha Jordan
Samantha Jordan - avatar
+ 1
For exemple you can fill it with generating for it random numbers or with the user's input
28th Nov 2016, 8:20 PM
Nicoletta Alba
Nicoletta Alba - avatar
0
list=[]
19th Sep 2016, 4:38 PM
Wai Hlyan Htun
Wai Hlyan Htun - avatar