import randomflag = 1try_=0while (flag): try_ +=1 yan = "" for i in range(0,4): cun=random.randrange(1,4) if cun==i: tmp=chr(random.randint(65,90)) el ...
import random
flag = 1
try_=0
while (flag):
try_ +=1
yan = ""
for i in range(0,4):
cun=random.randrange(1,4)
if cun==i:
tmp=chr(random.randint(65,90))
else:
tmp=random.randrange(0,9)
yan+=str(tmp)
print(yan)
var=input("請輸入驗證碼:")
if var == yan:
print('驗證成功')
break
else:
print("驗證失敗")
if try_ == 3:
print("輸入次數超3過次,請過會兒再試...")
break
憋了好久了,知識這種東西久了不用會生鏽的....