{"id":15303,"date":"2021-09-30T17:00:42","date_gmt":"2021-09-30T11:30:42","guid":{"rendered":"https:\/\/python-programs.com\/?p=15303"},"modified":"2021-11-22T18:33:33","modified_gmt":"2021-11-22T13:03:33","slug":"python-program-to-check-a-number-is-narcissistic-number-or-not","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-check-a-number-is-narcissistic-number-or-not\/","title":{"rendered":"Python Program to Check a number is Narcissistic Number or Not"},"content":{"rendered":"

Guys who are serious about learning the concepts of the java programming language should practice this list of programs in java<\/a> and get a good grip on it for better results in exams or interviews.<\/p>\n

Given a number, the task is to check whether the given number is a Narcissistic Number or Not in Python.<\/p>\n

Narcissistic Number:<\/strong><\/p>\n

Narcissistic numbers are a type of number that can be generated by adding the sum of its own digits raised to the power of the number of digits.<\/p>\n

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

370<\/p>\n

Number of digits=3<\/p>\n

3*(Number of digits)+7*(Number of digits)+0*(Number of digits)<\/p>\n

3^(3)+7^(3)+0^3=370<\/p>\n

So it is a Narcissistic Number.<\/p>\n

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

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

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

Given Number =370<\/pre>\n

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

The given Number { 370 } is a Narcissistic Number<\/pre>\n

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

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

Given Number =371<\/pre>\n

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

The given Number { 371 } is a Narcissistic Number<\/pre>\n

Program to Check a number is Narcissistic Number or Not in Python<\/h2>\n

Below are the ways to check whether the given number is a Narcissistic Number or Not in Python.<\/p>\n