How you would change the code below so that a new password is asked until the password is strong? I know that you have to use a while loop but I keep making a mess of it every time I try.
digits = False
upcase = False
lowcase = False
alnum = False
password = input("Enter a password between 6 and 12 characters: ")
while len(password) < 6 or len(password)>12:
    if len(password)<6:
        print("your password is too short")
    elif len(password) > 12:
        print("your password is too long")
    password = input("Please enter a password between 6 and 12 characters.")
for i in range(0,len(password)):
    if password[i].isupper():
        upcase = True
    if password[i].islower():
        lowcase = True
    if password[i].isalnum():
        alnum = True
    if password[i].isdigit():
        digits = True
if digits and alnum and lowcase and upcase and digits:
   print("Your password is strong")
elif (digits and alnum) or (digits and lowcase) or (digits and upcase) or (alnum and lowcase) or (alnum and upcase) or (lowcase and upcase):
    print("Your password is medium strength")
else:
    print("Your password is weak")
 
     
    