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))
На этой странице сайта вы можете посмотреть видео онлайн Python Numbers. Python code with example. Python Complete Course Video # 6 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Guangshu Coder 30 Декабрь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 38 раз и оно понравилось like зрителям. Приятного просмотра!