• Type of Numbers :
    • Integers : Whole numbers
    • Floats (Floating Point numbers) : Decimal numbers
    • Complex numbers : Numbers that have real and imaginary parts

Type of numbers

  • Some maths operations that can be done using Python are:

    • Addition + : Adding numbers
    • Subtraction - : Subtracting numbers
    • Division / : Dividing numbers
    • Multiplication * : Multiply numbers
    • Exponential ** : x to the power of y
    • Modulo % : Leftover number from division
    • Floor division // : Returns the value of division without decimal points

Math operation

  • Example of Floor Division // Floor division

  • There’s a math module that can be imported to perform mathematical operations on numbers

import math

print(math.pow(5,3))

Math module

  • I can also import the random module and use the randint to generate random integers
import random

print(random.randint(1,10))
print(random.randint(1,10))
print(random.randint(1,10))

Random integers

  • Complex numbers can be declared by direct assignment like a = y + zj. y is a real number and z is imaginary number.
  • Aside of direct assignment the Complex function also can be used. It creates a complex number from a real part and an optional imaginary part. This is equivalent to (real + imag * 1j) where imag defaults to 0.
a = 3 + 17j

b = complex(6 + 19)

print(a)
print(type(a))

print(b)
print(type(b))

Complex numbers