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
PostgreSQLv16

Koodin suorituksen tulos näkyy tässä

Visible tests
1
Input
153
ExpectedTrue
2
Input
9474
ExpectedTrue
3
Input
10
ExpectedFalse
4
Input
0
ExpectedTrue
5
Input
123
ExpectedFalse
6
Input
1
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid