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:
x = 1 # int
y = 2.8 # float
z = 1j # complex
Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length.
Float, or "floating point number" is a number, positive or negative, containing one or more decimals.
Complex numbers are written with a "j" as the imaginary part
.#coding #programming #python #pythonprogramming #pythontutorial
python numbers
x = 1
y= 72.3
z = 7j
print(type(x))
print(type(y))
print(type(z))
int
x = 1
y = 2343435345345
z = -2343243
print(type(x))
print(type(y))
print(type(z))
float
x = 1.22
y = 2.0
z = -232.22
print(type(x))
print(type(y))
print(type(z))
float can also be scientific number with an "e" to indicate power
x = 34e4
y = 12E3
z = -3434e7
print(type(x))
print(type(y))
print(type(z))
complex
x = 3+8j
y = 5j
z = -9j
print(type(x))
print(type(y))
print(type(z))
On this page of the site you can watch the video online Python Numbers. Python code with example. Python Complete Course Video # 6 with a duration of hours minute second in good quality, which was uploaded by the user Guangshu Coder 30 December 2022, share the link with friends and acquaintances, this video has already been watched 38 times on youtube and it was liked by like viewers. Enjoy your viewing!