Variable - Number

Python supports three types of numbers - integers(whole numbers), floating point numbers(decimals) and also supports complex numbers.

Number Type
Descriptions
Syntax

int

  • integer

  • whole number

  • positive/negative

  • no decimals

x = 5

y = -1024

z = 102455638029

float

  • decimals

  • positive/negative

  • with an ‘e’

x = 3.7

y = -4.2

z = 12e4

complex

  • with a ‘j’

z = 4j

A complex number consists of an ordered pair of real floating-point numbers denoted by x + yj, where x and y are real numbers and j is the imaginary unit.

Last updated