×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

math.nan constant with example in Python

Python math.nan constant: Here, we are going to learn about the math.nan constant of math module with example in Python.
Submitted by IncludeHelp, on April 19, 2019

Python math.nan constant

math.nan constant is a predefined constant, which is defined in the math module, it returns floating-point nan (Not a Number), which is equivalent to float('nan').

Note: math.nan constant is available from Python 3.5

Syntax of math.nan constant:

    math.nan

Return value: float It returns a float value (nan) – that is the floating-point "Not a Number".

Example:

    Input:
    print(math.nan)

    Output:
    nan

Python code to demonstrate example of math.nan constant

# python code to demonstrate example of 
# math.nan constant

# importing math module
import math 

# printing value of nan
print("value of NaN = ", math.nan)

Output

value of NaN = nan

Reference: Python math library

Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.