len in python code example
Example 1: len python meaning
my_string = "Hello World"
my_list = ["apple", "banana", "orange"]
print(len(my_string))
print(len(my_list))
Example 2: len python
mystring = 'Hello'
len(mystring)
mylist = ['Hello', 'Goodbye', 'Morning']
len(mylist)
Example 3: length of a string python
string = "geeks"
print(len(string))
string = "geeks for geeks"
print(len(string))
Example 4: get length from variable python
len(var)
len() is a built-in function in python. You can use the len() to get the length of the given string, array, list, tuple, dictionary, etc. Value: the given value you want the length of. Return value a return an integer value i.e. the length of the given string, or array, or list, or collections.