Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NickyAlan/9fb533301ad12eae82e62984e7fed7be to your computer and use it in GitHub Desktop.
Save NickyAlan/9fb533301ad12eae82e62984e7fed7be to your computer and use it in GitHub Desktop.
# 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