+ 1

What are the lists?

I leaned that, list can store any value and it must have square brackets [ ] to store value and you can separate value by using comma, here it is list=[1, 2,3,"Computer", 3.5,] Questions, 1. Can we make a list without value? 2.Can we store boolean?

17th Oct 2024, 3:40 AM
Farhan Ali
2 Answers
+ 9
1.yes list1 = [] 2.yes list1 = [True, False] also, do not use 'list' as a variable name. It will shadow the list keyword and you will not be able to use list() later on in your code. Sololearn does not provide error highlighting, but your code will probably tagged as problematic in a proper ide.
17th Oct 2024, 4:13 AM
Bob_Li
Bob_Li - avatar
+ 1
Farhan Ali the list as its name is a list of different elements which are in different variable formats even boolean as you questioned. Lists can be empty ,simple and nested lists which represent n dimension data like matrices and n dimension matrices.
18th Oct 2024, 2:38 PM
Mehdi Eslami
Mehdi Eslami - avatar