這個代碼應該說「請輸入一個新的密碼」,如果你從我創建的列表中輸入一個通用的密碼,然而它沒有,它只是說「密碼接受」,它應該「噸。任何人都可以幫助我嗎?下面是代碼本身:卡住這個代碼我已經使
### Asks user for their name and password ###
print "Hello, what is your name?"
### Stores name in variable myName ###
myName = raw_input()
print "Nice to meet you "+myName+", please enter a password to continue."
common_passwords = [ '123456', 'password', '12345', '12345678', 'qwerty',
'1234567890', 'baseball', 'dragon', 'football', '1234567',
'monkey', 'letmein', 'abc123', '111111', 'mustang', 'access',
'shadow', 'master', 'michael', 'superman', '696969', '123123',
'batman', 'trustno1']
while True:
password = raw_input()
if len(password) < 8:
print "Password is less than 8 characters."
print "Your password has to be 8 characters or more."
continue
found = False
for cpass in common_passwords:
if cpass == password:
print "You have selected a common password"
print "Please choose a new password"
found = True
break
if not found:
print "Password Accepted"
break
謝謝,所以這一直是我的縮進,現在它的作品,謝謝一堆。爲了上大學必須這樣做,並且我花了2個小時嘗試不同的事情,並且一直是縮進。 –
謝謝,我是一個noob在這裏,但我會留下來,因爲沒有想到如此快速的迴應:) –