Another way of creating an empty list | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponses
+ 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