Answer to Question #220419 in Python for Hari nadh babu

Question #220419

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

1
Expert's answer
2021-07-27T21:25:02-0400
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") 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS