Len Function In python

Len() Function In python | Python len() function in Hindi

Python

Len Function In python :- len() function ko ham python me length nikal ne ke liye istemal karte hai or is function se ham kisi bhi character & number & string & list& tuple & dict etc len nikal sakte hai. Let See Example Python Len() Example with Lists & tuple & string & Set & Object etc

Len Function In python

Contents

Len () python example

Python len() is a built in function that returns the length ( number of items ) of an object.

python me Len() Function Ko kese istemal karte hai iske ham example ke sath dekhte hai.

Python Len() Function Syntax

len(s)

Len() Func keval (1) parameter leta hai . Is parameter ke inside me aap in sab ka estemal kar sakte hai. Like :- Jese ki string & tuple & Dict & Char & List & bites & set.

Python Len() Example with Lists

>>> list1 = []
>>> len(list1)
0

>>> list2 = [1,2,3]
>>> len(list2)
3

Python Len() Example with Tuples

>>> tuple1 = ()
>>> len(tuple1)
0

>>> tuple2 = (1,2,3)
>>> len(tuple2)
3

Python Len() Example with Set

>>> set1 = {}
>>> len(set1)
0

>>> set2= {1,2,3}
>>> len(set2)
3

Python Len() Example with string

>>> str1 = ''
>>> len(str1)
0

>>> str2 = 'Python'
>>> len(str2)
6

Python Len() Example Custom objects

>>> class Example:
       def __len__(self):
            return 6

>>> obj = Example()
>>> obj.__len__()
6
>>> len(obj)
6
Python Len() func Video
Len() Function In Hindi

Dosto mujhe ummed hai ki aap Python Len() ko acchi tarah se samanj gye honge agar aap ko ye post acchi lage to mere is website ko jarur follow kre or ha agar aap video bhi dekhna chahte hai to aap mere channel ko bhi subscribe kar sakte hai. channel ka link aapko home page par mil jayega |

Leave a Reply

Your email address will not be published. Required fields are marked *