# Data Types in Python: Numbers

There are five standard data types in Python. They are: numbers,string, list, tuple and dictionary. These five data types are commonly referred as the “primitive data types” in Python. In this article, we are going to see how they are using in programming in a very basic level. You can then make your codes as complex as lithosphere!!

## Numbers:

• Store numeric values
• immutable. Changing the value of a variable would result in a creation of a new object.
• you can delete variable using the “del” statement. Now first rest come codes.

mynumbervariable=100

print(mynumbervariable)

myfloatvar=100.22

print(myfloatvar)

del myfloatvar

print(myfloatvar)

Output:

100

100.22

Traceback (most recent call last):

File “<tmp 3>”, line 8, in <module>

NameError: name ‘myfloatvar’ is not defined

Please notice that as the del statement deleted the myfloatvar variable, the last print statement resulted in an error.

### Number types in Python:

There are again four types of numbers that can be used in Python programming.

1. Plain Integers: -231 to 231 – 1, usually represented in the base 10 (decimal) format.
2. Long integers: less than -231 to greater than 231 – 1. The suffix “l” or “L” at the end of any integer value denotes a long integer. Note, you don’t need to add L while declaring the variable. Python knows what type of integer it would be.
3. Floating point real numbers/float: range from +10308.25 through -10308.25Float values can have two parts, a decimal point part and an optional exponent part.
4. Complex numbers: an ordered pair of real floating point numbers denoted by a + bj.

Time for some code examples:

mynumbervariable=100

print(mynumbervariable)

#–>100

myfloatvar=100.22

print(myfloatvar)

#–>100.22

#delete myfloatvar

del myfloatvar

print(myfloatvar)

#–>Error

#Long integer

longvar=53513362984333

print(longvar)

#–>53513362984333

#float variables

afloat=1.1

bfloat=-13.5

cfloat=88.9965

dfloat=3.3e10

efloat=3.3e-10

print(afloat,bfloat,cfloat,dfloat,efloat)

#–>1.1 -13.5 88.9965 33000000000.0 3.3e-10

print(dfloat/efloat)

#–>1e+20

#Complex Numbers

acomplex=1-2j

print(acomplex.real, acomplex.imag)

#–>1.0 -2.0

print(acomplex**2)

#–>(-3-4j)