Advertisement
gauravssnl

ArmstrongNumber.py

Apr 29th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. # ArmstrongNumber.py
  2. __author__ = "gauravssnl"
  3.  
  4. def armstrong(n):
  5.     new = str(n)
  6.     sum = 0
  7.     for d in new :
  8.         sum += pow(eval(d),3)
  9.     if sum == n :
  10.         return True
  11.     else:
  12.         return False
  13.  
  14. print( armstrong(370) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement