{"id":24194,"date":"2021-10-14T09:17:50","date_gmt":"2021-10-14T03:47:50","guid":{"rendered":"https:\/\/python-programs.com\/?p=24194"},"modified":"2021-11-05T20:55:23","modified_gmt":"2021-11-05T15:25:23","slug":"python-program-for-isnan-function","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-isnan-function\/","title":{"rendered":"Python Program for isnan() Function"},"content":{"rendered":"

In the previous article, we have discussed Python Program for isinf() Function<\/a>
\nisnan() Function in Python:<\/strong><\/p>\n

The math.isnan() method determines whether a value is NaN (Not a Number).<\/p>\n

If the specified value is a NaN, this method returns true; otherwise, it returns False.<\/p>\n

Syntax:<\/strong><\/p>\n

math.isnan(x)<\/pre>\n

parameters:<\/strong><\/p>\n

x:<\/strong> This is required. It is a value to be checked.<\/p>\n

Return Value: <\/strong>It returns a boolean value that is True if the value is NaN and False otherwise.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Value = -200.02\r\nGiven Value = 500\r\nGiven Value = math.nan\r\nGiven Value = math.inf\r\nGiven Value = NaN<\/pre>\n

Output:<\/strong><\/p>\n

False\r\nFalse\r\nTrue\r\nFalse\r\nTrue<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Value = -850.07\r\nGiven Value =  nan<\/pre>\n

Output:<\/strong><\/p>\n

False\r\nTrue<\/pre>\n

Program for isnan() Function in Python<\/h2>\n