Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

I need to check whether 153 is a Narcissistic number, but I'm just figuring out how to start it. Can anyone please help me!

1 Answer

0 votes
by (26.4k points)

Try the below function, which will solve it:

def check_is_narcis_number(your_number):

    your_numbers = str(your_number)

    power = len(your_numbers)

    your_sum = 0

    for number in your_numbers:

        your_sum += pow(int(number), power)

    if your_sum == your_number:

        return True

    return False

Want to become a python expert? Come and join python certification course.

Related questions

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
asked Feb 8, 2021 in Python by ashely (50.2k points)
0 votes
1 answer
asked Feb 7, 2021 in Python by laddulakshana (16.4k points)

Browse Categories

...