Skip to content

Instantly share code, notes, and snippets.

@carlos-menezes
carlos-menezes / is_armstrong.py
Last active July 20, 2018 10:57
Checks if a number is an Armstrong number.
# An armstrong number is a number that is the sum of its own digits raised to the power of number of digits that make up the original number.
import sys
def is_armstrong(n):
n = int(n)
sum_result = 0
# 1. Split the number into it's digits and store them in a list.
digits = list(str(n))