ユーザーはパスワードを入力する必要がありますが、パスワードには少なくとも 1 つの大文字、小文字、および数字が含まれている必要があります。
password = input("Please enter a password: ")
ユーザーはパスワードを入力する必要がありますが、パスワードには少なくとも 1 つの大文字、小文字、および数字が含まれている必要があります。
password = input("Please enter a password: ")
if any(x.isupper() for x in password) and \
any(x.islower() for x in password) and \
any(x.isdigit() for x in password):
print ("Congratulations, you have a secure password.")
これらの条件が一致するまで停止しない while ループを挿入することもできます。
while True:
password = input("Please enter a password: ")
if any(x.isupper() for x in password) and \
any(x.islower() for x in password) and \
any(x.isdigit() for x in password): #copy from Rob's awnser
break
else: print('Invalid!')