We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97eb1f2 commit 8a0b96dCopy full SHA for 8a0b96d
four_digit_num_combination.py
@@ -1,13 +1,16 @@
1
+""" small script to learn how to print out all 4-digit num"""
2
+
3
# ALL the combinations of 4 digit combo
-def FourDigitCombinations():
- numbers=[]
4
+def four_digit_combinations():
5
+ """ print out all 4-digit numbers in old way"""
6
+ numbers = []
7
for code in range(10000):
- code=str(code).zfill(4)
8
+ code = str(code).zfill(4)
9
print(code)
10
numbers.append(code)
11
12
# Same as above but more pythonic
-def oneLineCombinations():
13
+def one_line_combinations():
14
""" print out all 4-digit numbers """
15
numbers = [str(i).zfill(4) for i in range(10000)]
16
print(numbers)
0 commit comments