Created
July 16, 2021 23:01
-
-
Save changtimwu/1378823c1427fe862a3c56b87a7c3855 to your computer and use it in GitHub Desktop.
This file contains 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
#正經八百 | |
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