Program for Armstrong Numbers |
def armstrong ( n ) : NEW_LINE INDENT number = str ( n ) NEW_LINE n = len ( number ) NEW_LINE output = 0 NEW_LINE for i in number : NEW_LINE output = output + int ( i ) ** n NEW_LINE if output == int ( number ) : NEW_LINE INDENT return ( True ) NEW_LINE DEDENT else : NEW_LINE INDENT return ( False ) NEW_LINE DEDENT DEDENT print ( armstrong ( 153 ) ) NEW_LINE print ( armstrong ( 120 ) ) NEW_LINE