3-digit Armstrong Number
Write a Python program of 3-digit Armstrong Number. It consists of two test cases
The below link contains 3-digit Armstrong Number - Question, explanation and test cases
https://drive.google.com/file/d/1TDj5IcRLuj8MFif4X8tqX9KBoZrr4nO-/view?usp=sharing
We need all test caese can be come while code was running
X= int(input())
sum1 = 0
temp = X
n = len(str(X))
while temp > 0:
d = temp % 10
sum1 += d ** n
temp //= 10
if X == sum1:
print("True")
else:
print("False")
Comments
Leave a comment