Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python len

>>> len(‘hello’)
5
>>> len(‘My very energetic monster just scarfed nachos.’)
46
>>> len(”)
0
>>> avengers = [‘hulk’, ‘iron-man’, ‘Captain-America’, ‘Thor’]
>>> len(avengers)
4
>>> names = (‘Mike’, ‘Josh’, ‘Ope’, ‘Toby’, ‘Fred’, ‘Krish’)
>>> print(len(names))
6
>>> bierce = {
… “day”: “A period of twenty-four hours, mostly misspent”,
… “positive”: “Mistaken at the top of one’s voice”,
… “misfortune”: “The kind of fortune that never misses”,
… }
>>> type(bierce)
<type ‘dict’>
>>> print(len(bierce))
3
Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #python #len
ADD COMMENT
Topic
Name
6+6 =