(n)
| 1 | # ALL the combinations of n digit combo |
| 2 | def 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: |