で助けてください。このコードでは、パスワード入力を受け取り、パスワードの良さと悪さを示すスコアを付けています。私はそれを実行しようとするたびに、それは私に次のエラーメッセージを与え、私はそれが何を意味するのか分からない。タイプエラー
TypeError Traceback (most recent call last) in() 22 print("this password is worth",points,"points") 23 ---> 24 write_password()
in write_password() 12 askpassword = "askpassword".strip().lower() 13 for triple in triples: ---> 14 if triple in askpassword: 15 points += -5 16 for char in askpassword:
TypeError: 'in ' requires string as left operand, not list
そして、これはコードです:
def write_password():
points = 0
#askpassword = input("enter in a password. only use the chasricters")
#char = "qwertyuiopasdfghjklzxcvbnmQERTYUIOPASDFGHJKLZXCVBNM"
askpassword = "asdf"
char = ["qwertyuiop","asdfghjkl", "zxcvbnm"]
triples = []
for chars in char:
for i in range(len(chars)-2):
triples.append(char[i:i+3])
askpassword = "askpassword".strip().lower()
for triple in triples:
if triple in askpassword:
points += -5
for char in askpassword:
if char in askpassword:
if len (askpassword) >= 8:
points = points + 1
else:
print("no points")
print("this password is worth",points,"points")
write_password()
助けてください。前もって感謝します。