Longueur de la liste Python
len([x for x in range(10)])
10
len([1,2,3,[1,2,3]])
4
David Cao
len([x for x in range(10)])
10
len([1,2,3,[1,2,3]])
4
myList = [1,2,3]
len(myList) #Output 3
nestedList = ['Krishna', 20,'John', [20, 40, 50, 65, 22], 'Yung', 11.98]
print("Original List = ", nestedList)
print("Length of a Nested List = ", len(nestedList[3]))
# Let's create a list with a few sample colors
colors = ["Red", "Blue", "Orange", "Pink"]
print(len(colors)) # Expected output - 4