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))
In questa pagina del sito puoi guardare il video online Python Numbers. Python code with example. Python Complete Course Video # 6 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Guangshu Coder 30 dicembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 38 volte e gli è piaciuto like spettatori. Buona visione!