Python
Python Programming for Beginners: A Comprehensive Guide
Python Environment Set Up
Python Basic Syntax
Python Variables
Python Data Types
Python String
Python Numbers
Python Casting
Python List
Python Tuple
Python Set
Python Dictionaries
Python Boolean
Python Arrays
Python Operators
Python For Loop
Python while Loop
Python if elif else
Functions in Python
Python Lambda
Python Classes & Objects
Python Inheritance
Python Scope
Python Modules
Python Math
Python RegEx
Python User Input
Python try except
Python finally
Python Logging
Create a Python Project
Python Managing Application Dependencies
Numbers in Python
- Last updated Apr 25, 2024
In Python, numbers can be represented in many ways and Python provides different types for working with these numbers. The primary numeric types in Python include:
- int
- float
- complex
int
The int data type is a numeric type without fractional point.
Example:
x = 100
print(x)
Output:
100
float
The float data type is a numeric type with fraction point.
Example:
x = 100.70
y = 53e43
print(x)
print(y)
Output:
100.70 5.3e+44
complex
The complex data type is a numeric type with real and imaginary components denoted by j character.
Example:
z = 7j
print(z)
Output:
7j