Here you’ll get a python program to examine Armstrong variety.
A variety is alleged to be AN Armstrong number if the total of its digits raised to the facility n is adequate to itself. Here n is total digits in variety.
For example, 370 is Armstrong variety.
Here n = 3, thus thirty three + seventy three + zero3 = twenty seven + 343 + 0 = 370
Python Code to Check Armstrong Number
num = int(input("enter a number: "))
length = len(str(num))
sum = 0
temp = num
while(temp != 0):
sum = sum + ((temp % 10) ** length)
temp = temp // 10
if sum == num:
print("armstrong number")
else:
print("not armstrong number")
Output
enter a number: 370
Armstrong number
Comment below if you have got any queries associated with on top of the program for Armstrong variety in python.