Python Numbers
There are three
numeric types in Python:
- int
- float
- complex
Variables of numeric
types are created when you assign a value to them:
Example
x = 111 # int
y = 23.878 # float
z = 1j # complex
y = 23.878 # float
z = 1j # complex
To verify the type of
any object in Python, use the type() function:
Example
print(type(x))
print(type(y))
print(type(z))
print(type(y))
print(type(z))
output:-
<class'int'>
<class'float'>
<class
'complex'>
No comments:
Post a Comment