6 #python free course:
# Python Number
X = 1 # Int
Y = 2.8 # Float
Z = 1j # Complex
# Two Verify Types
print(type(X))
print(type(Y))
print(type(Z))
# Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length.
x = 1
y = 2642375356486759786
z = -6897698
print(type(x))
print(type(y))
print(type(z))
# Float, or "floating point number" is a number, positive or negative, containing one or more decimals.
x = 1.9900
y = 2.879
z = -60.678
print(type(x))
print(type(y))
print(type(z))
# Float,can also be scientific or "floating point number" is a number, positive or negative, containing one or more decimals.
x = 1e9900
y = 2E879
z = -60.67e8
print(type(x))
print(type(y))
print(type(z))
#Complex numbers are written with a "j" as the imaginary part
x = 1 + 5j
y = 5j
z = -5j
print(type(x))
print(type(y))
print(type(z))
#Type conversion
#you can type one type to anouthor
x1 = 1
y1= 5.5
z1 = 5
a = float(x1)
b = int(y1)
c = complex(z1)
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
Post a Comment
If you have any doubts. Please Let me Know