0% found this document useful (0 votes)
16 views2 pages

Class 5 Datatype Int

The document outlines the 14 data types in Python, including int, float, and str, and their applications in various fields such as web development and machine learning. It explains how to check a variable's data type using the 'type()' function and describes how to convert integers into different formats like decimal, binary, octal, and hexadecimal. Additionally, it briefly mentions the limitations of Python.

Uploaded by

kunala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Class 5 Datatype Int

The document outlines the 14 data types in Python, including int, float, and str, and their applications in various fields such as web development and machine learning. It explains how to check a variable's data type using the 'type()' function and describes how to convert integers into different formats like decimal, binary, octal, and hexadecimal. Additionally, it briefly mentions the limitations of Python.

Uploaded by

kunala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Data types:-

Data type represent the type of data present inside a variable.

There are 14 types of data types present in python.

[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link] developing Desktop application.
[Link] developing web app.
[Link] developing database app.
[Link] Network programming.
[Link] developing games.
[Link] Data analysis application and data science.
[Link] machine learning.
[Link] AI(Artificial Inteligence) app.
[Link] IOT(Internet of things)

Limitation of python.
How to check a variable which data type is holding?

ans:- type()

Int(integer)

we can use int data type to represent whole number(integral value)

>>> a=10
>>> type(a)
<class 'int'>

how can we convert int as other format?

[Link] form(float)
[Link] form
[Link] form
[Link] decimal form

[Link] form(float)(base-10)

It is the default number system in python


the allowed digits are : 0 to 9

ex:- a= 10
float(a)
10.0

[Link] form(base-2)

the allowed digits are : 0 and 1


Literal value should be prefixed with 0b or 0B.
use bin()
>>> a = 10
>>> bin(a)
'0b1010'
>>>

[Link] Form(Base-8)
the allowed digits are : 0 to 7
Literal value should be prefixed with 0o or 0O.
use oct()
>>> a = 10
>>> b = oct(a)
>>> b
'0o12'

[Link] Decimal Form(Base - 16)

the allowed digits are : 0 to 9 and a to f(both are lower and upper)
Literal value should be prefixed with 0x or 0X.

use hex().

ex:-
>>> a = 10
>>> b = hex(a)
>>> b
'0xa

You might also like