Długość listy Python
list = [a, b, c]
len(list)
#output 3
David Cao
list = [a, b, c]
len(list)
#output 3
len([x for x in range(10)])
10
len([1,2,3,[1,2,3]])
4
myList = [1,2,3]
len(myList) #Output 3
#i will print out first choice, but len specifies length
#and range specifies total emcompassed length.
students = ["Hermione", "Harry", "Ron"]
for i in range(len(students)):
print(students[i])
# Let's create a list with a few sample colors
colors = ["Red", "Blue", "Orange", "Pink"]
print(len(colors)) # Expected output - 4
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]))