- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharmstrong.py
More file actions
Latest commit
21 lines (11 loc) · 430 Bytes
/
Copy patharmstrong.py
File metadata and controls
21 lines (11 loc) · 430 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
importsys
START, LIMIT=int(sys.argv[1]), int(sys.argv[2])
defmake_armstrong(a: int, b: int) -> [int]:
return [xforxinrange(a, b) ifis_armstrong(x)]
defis_armstrong(n: int) ->bool:
returnn==sum(cubes(digits(n)))
defcubes(ds: int) ->int:
return [d**len(ds) fordinds]
defdigits(n: int) -> [int]:
return [int(ch) forchinstr(n)]
print(make_armstrong(START, LIMIT))