Skip to main content

Python Numbers

Python number datatype is used for numeric values. Number object is created when you give the numeric value to the variables.There are three  differeent types of  numeric types are available in python.They are Integers, Floats and Complex numbers.

The Python tutorial on Techtuts provides an information about Python and Python 3 from the basis to high level. This tutorial provides a good understanding about the Python and Python for Technical, Non-Technical People, College Students and Working Professionals. Given examples are an easy to write and simple to practice by yourself.

In this tutorial you will learn about the  Python and Python3. This tutorial includes  an Introduction, Python Environment Setup, Variables, Data types , Control flow Statements, Loops, Functions, Data Structures, Modules ,Files, Classes, Python Web Frameworks etc

Python Numeric types

Python  number datatype has three types for using numercal and arithmetic Operarions

  1. Integers
  2. Floats
  3. ComplexNumbers

Integers

Integer data type holds the values of whole numbers and negative numbers.

Examples for integers

-3,-2,-1,0,1,2,3

>>> a=5
>>> print(type(a))
 <class 'int'>
>>> a=-5
>>> print(type(a))
 <class 'int'>

Floats

Float data type holds the values of numbers and negative with decimal points.

Examples for Floats

-3.5,-2.5,-1.5,0.5,1.5,2.5,3.5

>>> a=0.5
>>> print(type(a))
 <class 'float'>
>>> a=-0.5
>>> print(type(a))
 <class 'float'>

Complex Numbers

Complex data type holds  the number values with real and imaginary parts.

Examples for complex numbers

1+2j, 2+3j 

>>> a=1+2j
>>> print(type(a))
 <class 'complex'>