Another way of creating an empty list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Another way of creating an empty list

Would empty_list = list() be another way for making a new, empty list?

16th Apr 2018, 7:13 PM
Marvin
Marvin - avatar
2 Answers
+ 5
Another way. x=[1,2,3] x.clear() print(x) #output=[]
17th Apr 2018, 6:57 AM
Maninder $ingh
Maninder $ingh - avatar
+ 1
Never mind then. yes that also works! I tested mine cleanly.
16th Apr 2018, 7:14 PM
Marvin
Marvin - avatar