Skip to content

Commit 9438b64

Browse files
Merge pull request #237 from faresbessrour/pythonic
More Pythonic way to get the combinations
2 parents 314d64c + 1703a94 commit 9438b64

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

4 Digit Number Combinations.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ def FourDigitCombinations():
55
code=str(code).zfill(4)
66
print code,
77
numbers.append(code)
8+
9+
# Same as above but more pythonic
10+
def oneLineCombinations():
11+
numbers = list(map(lambda x: str(x).zfill(4), [i for i in range(1000)]))
12+
print(numbers)

0 commit comments

Comments
 (0)