loading...
Cover image for Check for Armstrong Number

Check for Armstrong Number

codeperfectplus profile image CodePerfectPlus Updated on ・1 min read

Alt Text

Topic : Armstrong Number

Problem Statemen:

An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 153 is an Armstrong number since

1**3 + 5 **3 + 3**3 = 153.

Write a program to check the number is Armstrong number is not.

def is_armstrong_number(number):
    num = str(number)
    exp = len(num)
    return number == sum([int(i)**exp for i in num])

Share your solution to check Armstrong number.

Discussion

markdown guide