Wednesday, September 18, 2019

type keyword in python

  Python have a built-in method called as a type. If  a single argument (object)  is passed to type() built-in , it returns the type of object.

Syntax:
          type(object)

Example:
>>> x=5
>>> s="codingpartnerr"
>>> y=[1,2,3]
>>> print(type(x))
<class 'int'>
>>> print(type(s))
<class 'str'>
>>> print(type(y))
<class 'list'>
>>> 

No comments:

Post a Comment

type keyword in python

  Python have a built-in method called as a type. If  a single argument (object)  is passed to type() built-in , it returns the type of obj...