Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
It's simple solution in Creative category for Armstrong Number Checking by waffell
import math
def is_armstrong(num: int) -> bool:
return num == sum([math.pow(int(i), len(str(num))) for i in str(num)])
print("Example:")
print(is_armstrong(11))
# These "asserts" are used for self-checking
assert is_armstrong(153) == True
assert is_armstrong(370) == True
assert is_armstrong(947) == False
assert is_armstrong(371) == True
assert is_armstrong(407) == True
assert is_armstrong(163) == False
assert is_armstrong(100) == False
assert is_armstrong(8208) == True
assert is_armstrong(930) == False
assert is_armstrong(4) == True
print("The mission is done! Click 'Check Solution' to earn rewards!")
Jan. 15, 2024