Python

Python Menu

Python

Python type() Function - Definition, Syntax, Parameters, Examples

Definition

The type() function returns the type of the specified object.

Syntax

type(object, bases, dict)

Parameters

Parameter Description
object Required. If only one parameter is specified, the type() function returns the type of this object
bases Optional. Specifies the base classes
dict Optional. Specifies the namespace with the definition for the class

Examples

fruits = ('apple', 'banana', 'cherry') myString = "Hello World" myInt = 33 x = type(fruits) y = type(myString) z = type(myInt) print(x) print(y) print(z)

Introduction

Python Basics

Python Advance

Data Science Python Tutorials

Python Functions and Methods