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

Class 5 Datatype Int

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)
14 views2 pages

Class 5 Datatype Int

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
You are on page 1/ 2

Data types:-

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

There are 14 types of data types present in python.

1.int
2.float
3.complex
4.bool
5.str
6.bytes
7.bytearray
8.range
9.list
10.tuple
11.set
12.frozenset
13.dictionary
14.None
1.For developing Desktop application.
2.For developing web app.
3.For developing database app.
4.For Network programming.
5.For developing games.
6.Fotr Data analysis application and data science.
7.For machine learning.
8.For AI(Artificial Inteligence) app.
9.Fot 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?

1.Decimal form(float)
2.Binary form
3.octal form
4.hexa decimal form

1.Decimal 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

2.Binary 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'
>>>

3.Octal 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'

4.Hexa 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