Loading...
Loading...
Loading...
A number is an Armstrong number if the sum of its digits, each raised to the power of the number of digits, equals the number itself. For example, 153 has 3 digits and 1³ + 5³ + 3³ = 153.
Given n, print Armstrong or Not Armstrong.
Armstrong or Not Armstrong.Example 1
Input
153
Output
Armstrong
Example 2
Input
154
Output
Not Armstrong
Try the problem first. Open one hint at a time.
You need the number of digits first. Count them in one loop.
Then go through the digits again, add each digit raised to that power, and compare the total with n. Use a copy of n in each loop.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor