Created
April 27, 2022 11:24
-
-
Save NickyAlan/9fb533301ad12eae82e62984e7fed7be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0001 - 9999 | |
num = [] | |
for i in range(100,10000): | |
n = str(i) | |
if len(n) != 4 : | |
n = '0' + n | |
if n[0] != n[1] and n[0] != n[2] and n[0] != n[3] and n[1] != n[2] and n[1] != n[3] and n[2] != n[3] : | |
num.append(n) | |
import csv | |
with open('num.csv','w', newline='') as f: | |
f.write(f'number between 0000-9999 but not the same\n') | |
for n in num : | |
f.write(f'{n}\n') | |
f.write(f'total number is {len(num)}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment