Skip to content

Commit 2c69b35

Browse files
Merge pull request #229 from Giftlin/patch-1
Create nDigitNumberCombinations.py
2 parents 1010002 + b3650de commit 2c69b35

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

nDigitNumberCombinations.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ALL the combinations of n digit combo
2+
def nDigitCombinations():
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:
10+
# handle all other exceptions
11+
pass
12+
return(numbers)

0 commit comments

Comments
 (0)