1string = "hello"
2print(len(string))
3#>>> Outputs "5"
4if len(string) >= 10:
5 print("This string is grater then 10")
6
7if len(string) <= 10:
8 print("This string is smaller then 10")
9
10# Outputs "This string is smaller then 10"
1# Python program to demonstrate the use of
2# len() method
3
4# Length of below string is 5
5string = "geeks"
6print(len(string))
7
8# Length of below string is 15
9string = "geeks for geeks"
10print(len(string))
1# Let's use the len() function
2print(len("Hello, World!!"))
3# this will return 14
1# to get the length of a string or array, use the len() method
2my_string = "Hello World"
3my_list = ["apple", "banana", "orange"]
4
5print(len(my_string)) # outputs 11
6print(len(my_list)) # outputs 3
1#!/usr/bin/python3
2
3str = "this is string example....wow!!!"
4print ("Length of the string: ", len(str))