Tuesday, 2 July 2019

How to find the address of the object and type of the object



Example program in Python:

>>> a=5 # Here 5 integer value. 
>>> print(type(a)) # type() is used to find the data type of object
Result is:
<class 'int'>
>>> print(id(a)) # id() function is used to find the address of the object
Result is:
1526782192
>>> print(a) # value of the object
Result is:
5

No comments:

Post a Comment

Files with Exception handling

#Ask the user to take two input integer values var a,b try:     a=int(input("enter any integer value:"))     b=int(input(...