Answered by : david-cao
len([x for x in range(10)])
10
len([1,2,3,[1,2,3]])
4
Source : https://www.howtouselinux.com/post/get-the-length-of-a-python-list | Last Update : Sun, 06 Mar 22
Answered by : lonely-lyrebird-3uid5nfcwlfc
my_list = [1,2,3,4,5,6,7,8,9,10]
length_of_list = len(my_list)
Source : | Last Update : Thu, 09 Jul 20
Answered by : wicked-wryneck-66duv5f0h2d7
myList = [1,2,3]
len(myList) #Output 3
Source : | Last Update : Sun, 20 Feb 22
Answered by : vihaan-c
list = ['a','b','c']
len(list)
Source : https://www.stackvidhya.com/count-number-of-elements-in-list/ | Last Update : Mon, 23 May 22
Answered by : cautious-cow-bbroqcwlj6cj
alphabet=['a','b','c','d','e']
# length of list or size of a list
print('length of list:',len(alphabet))
Source : https://www.oraask.com/wiki/python-list-length | Last Update : Mon, 07 Mar 22
Answered by : rajitha-amarasinghe
# It doesn't matter what is the type of the item
# It will count the number of items in the list
x = [1, 2, 5.67, 2.45, 'John', 'Pat', True, False]
length = len(x) # This gives us an integer
print('number of items in the list is:', length)
Source : | Last Update : Fri, 19 Aug 22
Answered by : hutch-polecat
lenoflist = len(urlist)
Source : | Last Update : Thu, 13 Oct 22
Answered by : david-cao
#get length of list in Python using for loop
List = [‘Python’,’Java’,’Kotlin’,’Machine Learning’,’Keras’]
size = 0
print(“Length of the input string:”)
for x in List: size+=1 print(size)
Output:
Length of the input string:
5
Source : https://www.howtouselinux.com/post/get-the-length-of-a-python-list | Last Update : Mon, 30 May 22