Data types define the type of data a variable can hold, for example an integer variable can hold integer data, a character type variable can hold character data etc.
It contains integer value.
x=2 print(type(x))
Here the output of above code is "<class 'int'>"
Here "type()" is function return the datatype of the variable.
It contains integer Decimal value..
x=2.0 print(type(x))
Here the output of above code is "<class 'float'>"
It contains integer Decimal value..
x="e" print(type(x))
Here the output of above code is <class 'char'>
Booleans represets the value in the term of "True" or "False".
it returns only any expression is given like if we compare two or more operends then the value return in the form of booleans
print(5<2) print(2==3)
Here the output of above code is
True
False
Many times it is used with "if-else".
if 5>2: print("Small Code") else: print("5 is less then 2")
Small Code
bool() function are used to evaluate any datatype into in term of "True" or "False".
x=2 y="Small Code" print(bool(x)) print(bool(y))
True True
As we all known comlex number is in the form of "a+bj" here "a" is a real part and "bj" is a imaginary part.
x=2+5j print(type(x))
<class 'complex'>
complex() function are used convert any datatype to complex form.
x=2 y=4.0 print(complex(x)) print(complex(y))
(2+0j) (4+0j)