Armstrong Number Check
An Armstrong number is a neat example of checking a number through its own digits. The function is_armstrong receives an integer n and returns True if n equals the sum of its digits raised to the power of the digit count. For example, with a three-digit number, raise each digit to the third power and add the results.
Примеры
Ввод
153Вывод
TrueВвод
9474Вывод
TrueВвод
10Вывод
FalseНужно реализовать
def is_armstrong(n: int) -> bool:
Теги
math
Συνδεθείτε για να δείτε το ιστορικό υποβολών
ΣύνδεσηΣυνδεθείτε για να χρησιμοποιήσετε τον AI Mentor
ΣύνδεσηVisible tests
1
Input
153Expected
True2
Input
9474Expected
True3
Input
10Expected
False4
Input
0Expected
True5
Input
123Expected
False6
Input
1Expected
TrueFocus radio
Paused · SomaFM · Fluid