def armstrong(number):
num_str = str(number)
return number == sum(int(digit) ** len(num_str) for digit in num_str)
num = int(input("Enter a number: "))
if armstrong(num):
print(f"{num} is an Armstrong number.")
else:
print(f"{num} is not an Armstrong number.")
Explanation:
def armstrong(number):
str(number):
int(digit) ** len(num_str):
Input
Check and Output
Depending on the result:
#source code --> clcoding.com