A number is said to be an armstrong number if it's sum of digit with power of length of number is equal to the actual number.
example -
153 is an armstrong number because 1**3+5**3+3**3=153
Program to show the all armstrong number from 0 to 1000-
def checkarmstrong(n):
ans=0
a=n
l=len(str(n))
while(a>0):
t=a%10
ans=ans+t**l
a=int(a/10)
if ans==n:
return 1
else:
return 0
for i in range(1000):
if checkarmstrong(i):
print(i,end=" ")
0 1 2 3 4 5 6 7 8 9 153 370 371 407