MCPcopy Create free account
hub / github.com/geekcomputers/Python / nDigitCombinations

Function nDigitCombinations

nDigitNumberCombinations.py:2–12  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1# ALL the combinations of n digit combo
2def nDigitCombinations(n):
3 try:
4 npow = 10**n
5 numbers = []
6 for code in range(npow):
7 code = str(code).zfill(n)
8 numbers.append(code)
9 except Exception:
10 # handle all other exceptions
11 pass
12 return numbers
13
14
15# An alternate solution:

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected