- Python Basics
- Python Home
- Python History
- Python Applications
- Python Features
- Python Versions
- Python Environment Setup
- Python Basic Syntax
- Python end (end=)
- Python sep (sep=)
- Python Comments
- Python Identifiers
- Python Variables
- Python Operators
- Python Ternary Operator
- Python Operator Precedence
- Python Control & Decision
- Python Decision Making
- Python if elif else
- Python Loops
- Python for Loop
- Python while Loop
- Python break Statement
- Python continue Statement
- Python pass Statement
- Python break Vs continue
- Python pass Vs continue
- Python Built-in Types
- Python Data Types
- Python Lists
- Python Tuples
- Python Sets
- Python frozenset
- Python Dictionary
- List Vs Tuple Vs Dict Vs Set
- Python Numbers
- Python Strings
- Python bytes
- Python bytearray
- Python memoryview
- Python Misc Topics
- Python Functions
- Python Variable Scope
- Python Enumeration
- Python import Statement
- Python Modules
- Python operator Module
- Python os Module
- Python Date & Time
- Python Exception Handling
- Python File Handling
- Python Advanced
- Python Classes & Objects
- Python @classmethod Decorator
- Python @staticmethod Decorator
- Python Class Vs Static Method
- Python @property Decorator
- Python Regular Expressions
- Python CGI Programming
- Python Network Programming
- Python Send E-mail
- Python Multi-threading
- Python XML Processing
- Python MySQL Database
- Python GUI Programming
- Python Event Handling
- Python Keywords
- Python All Keywords
- Python and
- Python or
- Python not
- Python True
- Python False
- Python None
- Python in
- Python is
- Python as
- Python with
- Python yield
- Python return
- Python del
- Python from
- Python lambda
- Python assert
- Python Built-in Functions
- Python All Built-in Functions
- Python print() Function
- Python input() Function
- Python int() Function
- Python len() Function
- Python range() Function
- Python str() Function
- Python ord() Function
- Python chr() Function
- Python read()
- Python write()
- Python open()
- Python Examples
- Python Examples
- Python Test
- Python Online Test
- Give Online Test
- All Test List
Python Numbers - int, float, and complex Type
« Previous Tutorial Next Tutorial »Numeric types in Python are used to store numeric values. The three numeric types in Python, are:
- int
- float
- complex
Note - The type() function is used to find the type of a value/variable. For example:
x = 45 y = 34.54 z = 12j print(type(x)) print(type(y)) print(type(z))
The output is:
<class 'int'> <class 'float'> <class 'complex'>
Python int Type
Any whole number is considered as of int type. For example, 12, 1, 0, -1345431234, 23456765432134565432 etc.
Python float Type
Any number with decimal (except the complex number) is considered as of float type. For example, 1.9, 2.0, -4253464.2433 etc.
Note - Numbers like 781e4, 23E3, -3542.6e10 etc. are also considered as floating-point number, where e or E indicates to the power of 10. Therefore these numbers are of float type.
The number 781e4 is equal to 7810000.0. Similarly the number -3542.6e5 is equal to -354260000.0.
Note - Number in the form of 123e32 can also be called as scientific number.
Python complex Type
Any number with imaginary part is considered as complex type. For example, 23+6j, 10j, -32j etc.
« Previous Tutorial Next Tutorial »