length in python code example
Example 1: how to get the length of a string in python
# Let's use the len() function
print(len("Hello, World!!"))
# this will return 14
Example 2: len python
mystring = 'Hello'
#Counts the amount of letters in the string
len(mystring) # = 5
#Can also count the number of items in a list
mylist = ['Hello', 'Goodbye', 'Morning']
len(mylist) # = 3