Python Fundamentals

Python Numbers

Python numbers types is integers, complex and python float point numbers

python numbers logo

if you don’t know what variables are you should see Python Variable

we will explain them simply, and dig in on followed lessons-tutorials..

Numbers In Python

and there is type() could be to get some number type, also isinstance()  is used to check if number belongs to specific class

age = 25

# Result : 'int'

# Result : 'float'

# Result : '28+3j'
c = 25 + 3j
print(c + 3)

# Result : True
print(isinstance(c, complex))

Numbers systems

System numbers is a little different than that, there is

Binary‘0b’ or ‘0B’
Octal‘0o’ or ‘0O’
Hexadecimal‘0x’ or ‘0X’
# Result : 107

# Result : 253 (251 + 2)
print(0xFB + 0b10)

# Result : 13

Python numbers used mainly in math, data science and almost everything andyou may need to expand your knowledge and see types like python long(…L) ,

You scale your knowledge as professionalize  as you want, and python will definitely help you to do that

Python Math

Python got modules like math, decimal, fractions, random and statistics

Python CMath

Cmath is just like math module but  is being used for complex numbers.

Write a Comment

Your email address will not be published. Required fields are marked *