Being a programmer, we can specify literal values in decimal, binary, octal and hexa decimal forms.
But PVM will always provide values
only in decimal form.
a= 10
b=0o10
c=0X10
d=0B10
print(a) 10
print(b) 8
print(c) 16
print(d)2
Python - Class 04( Python)
Date: 18th June 2024
By - Shyam Singh
We can use float data type to represent floating point values(decimal values)
e.g. f = 1.234
type(f) float
We can also represent floating point values by using exponential form (Scientific Notation)
e.g. f = 1.2e3 -> instead of 'e' we can use 'E'
Float Data Type
The main advantage of exponential form is we can represent big values in less memory.
We can represent int values in decimal , binary, octal and hexa decimal forms. But we can
represent float values only by using decimal form.
We can use this data type to represent Boolean values.
The Only allowed values for this data type are : True and false.
bool Data Type
Internally Python represent True as 1 and False as 0.
b=True
type(b)
A complex number is of the form
a+bj , a= Real Part and bj= Imaginary Part.
'a' and 'b' contain Integer OR Floating Point Values.
Complex Data Type
In the real part if we use int values then we can specify that either by
decimal,octal,binary or hexa decimal form.
But imaginary part should be specified only by using decimal form.
Even we can perform operations on complex type values.