Implemented intersection_of_sorted

This commit is contained in:
Артём Садаков 2026-04-16 21:35:22 +03:00
parent c1347e087c
commit 9dea34d7ac

View File

@ -1,3 +1,14 @@
def is_armstrong(n:int) -> bool:
pass
digits_str = str(n)
digits_len = len(digits_str)
total = 0
for digit in digits_str:
number = int(digit)
result = number ** digits_len
total = total + result
return total == n
if __name__ == "__main__":
print(f"is_armstrong(153) = {is_armstrong(153)}")
print(f"is_armstrong(10) = {is_armstrong(10)}")
print(f"is_armstrong(9474) = {is_armstrong(9474)}")
print(f"is_armstrong(123) = {is_armstrong(123)}")