Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Created July 16, 2021 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save changtimwu/1378823c1427fe862a3c56b87a7c3855 to your computer and use it in GitHub Desktop.
Save changtimwu/1378823c1427fe862a3c56b87a7c3855 to your computer and use it in GitHub Desktop.
#正經八百
def uniqnum( num):
digits=[]
while num>0:
r = num % 10
if r in digits:
return False
digits.append(r)
num = num // 10
return True
#投機取巧版
def uniqnum2( num):
s = str(num)
return len(set(s))==len(s)
def uniqlist( begin, end):
for num in range(begin, end):
if uniqnum2(num):
print(num, end=',')
print('')
qs=[ (10,15), (8,212)]
for q in qs:
uniqlist(q[0], q[1])
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment