Compare commits

...

2 Commits

2 changed files with 15 additions and 2 deletions

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)}")

2
solution18.py Normal file
View File

@ -0,0 +1,2 @@
def intersection_of_sorted(a: list, b: list) -> list:
pass