Get length of String or get count of List in Python

To calculate the length of any string or get the elements count of an Array or List, You can use len() function in Python.

1. Length of String

name = "Sheetal Kumar"
size = len(name)
print(size)

Output:

13

 

2. Length of List:

items = ["A","B","C","D"]
size = len(items)
print(size)

Output:

4

 



Keywords: