+ 1

What's an element

Connected to len

8th Jun 2019, 2:21 PM
Mike Harris
Mike Harris - avatar
5 Respuestas
+ 1
Corrected
8th Jun 2019, 2:30 PM
Mike Harris
Mike Harris - avatar
+ 1
In Python, with element you mean the comma "," separated things of the lists. In list [6, 8, "dog", False]: 6, 8, "dog" and False are typically called elements or items. len is a function, that counts the items in a list. With len you need to remember, that lists can also be items of a list, and these inner lists are counted as 1 single items, no matter how many items they had. print(len([1, False, ["KingKong", "Monkey", "Gorilla"])) This would output: 3
8th Jun 2019, 2:38 PM
Seb TheS
Seb TheS - avatar
+ 1
An element is another word for an item in a list. Len() is a function to get how many items are in a list
8th Jun 2019, 4:41 PM
Trigger
Trigger - avatar
0
I don't understand you!
8th Jun 2019, 2:28 PM
CodeFu
CodeFu - avatar
0
X = [2,3,4,5,6] this list called X has 5 elements
8th Jun 2019, 2:33 PM
Mo Hani
Mo Hani - avatar