#store integer using int() class
#variable declaration with value assigning using int() class or contractor
empid = int(25)
print(empid)
print(type(empid))
output : 25
<class : int>
You can also store integer values other than base 10 such as
Binary (base 2- 0,1)
Octal (base 8 - 0,1,2,3,4,5,6,7)
Hexadecimal numbers (base 16 - 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
Decimal(10 - 0,1,2,3,4,5,6,7,8,9)
Octal :
octnum=0o10
print(octnum)
print(type(octnum))
output:
8
<class 'int'>
Hexadecimal Numbers :
hexanum=0x10
print(hexanum)
print(type(hexanum))
Output:
16
<class 'int'>
Comments
Post a Comment