‘len(s)’ function is used to get the length of the object. Here the argument ‘s’ can be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).
len_string.py
s1 = 'hello'
s2 = 'World'
print('len(s1) : ', len(s1))
print('len(s2) : ', len(s2))
Output
len(s1) : 5 len(s2) : 5
Previous Next Home
No comments:
Post a Comment