Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 634 Bytes

infinity.md

File metadata and controls

26 lines (21 loc) · 634 Bytes

#Infinity Infinity in python can be represented in multiple ways. Positive infinity number is greatest, and the negative infinity number is the smallest of all numbers.

import math

# Positive infinity
ptive_inf = math.inf
print('Positive Infinity: ',ptive_inf)

# Negative infinity
ntive_inf = -math.inf
print('Negative Infinity: ',ntive_inf)

Or

# Define Positive infinity number
ptive_inf = float('inf')
print('Positive Infinity: ',ptive_inf)

# Define Negative infinity number
ntive_inf = float('-inf')
print('Negative Infinity: ',ntive_inf)

More info here