how to measure string length in python code example
Example 1: how to get length of string in python
string = "test"
print(len(string))
#>>> Output "4"
Example 2: 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 3: length of string python
string = "hello"
print(len(string))
#>>> Outputs "5"
if len(string) >= 10:
print("This string is grater then 10")
if len(string) <= 10:
print("This string is smaller then 10")
# Outputs "This string is smaller then 10"