Python type()

📔 : Python 🔗

predefined function type() का python में variables का type जानने के लिए किया जाता है।

Python type() Syntax

type(object)
  1. object | required : function में pass किया गया argument है जिसका type के बारे में पता करना है , यह argument required होता है।

Python type() Example

Copy Fullscreen Close Fullscreen Run
print( type("String") )  #string.
print( type(2) )         #int.
print( type(4.6) )       # float.
print( type((23,34)) )   #tuple.
print( type({23,34}) )   #set.
print( type([23,34]) )   #list.
print( type({"name":"rahul", "age":23}) )   #dictionary. 
Output
C:\Users\Rahulkumar\Desktop\python>python checkType.py
<class 'str'>
<class 'int'>
<class 'float'>
<class 'tuple'>
<class 'set'>
<class 'list'>
<class 'dict'>

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook