title: How to replace a double while loop?
body: <p>The program, which assesses password strength, initially checks whether the length of the password is correct (6-12) and whether the password contains extented ASCII characters, i.e. 127-255. </p>
  
  <p>The problem I have is that if the user first inputs a password which is too short or too long, the program then doesn't check for extended characters in the next password, inputted by the user and vice-versa, with checking for extended characters first.</p>
  
  <p>I implemented a double while loop, if that's the correct way of calling it, however it still didn't bring the desired effect.</p>
  
  <pre><code>import re
  import time
  #score variable, responsible for later defining if passwords is weak, medium or strong
  Score = 0
  #list for improvements to password printed out with score at the end
  Improvements = []
  Password = ""
  #defines function for checking for presence of extended characters (i.e. ascii 128-255)
  def hasExtended(s):
      return any(ord(i) &gt; 127 for i in s)
  #inputs password
  Password = input("Please enter a password:")
  Password_length = len(Password)
  Extended_presence = hasExtended(Password)
  #checks password length (6-12), asks user to re-input until password is within boundaries
  #checks if password contains extended characters
  #double while loops to allow for two conditions simultaneously
  while Password_length &lt; 6 or Password_length &gt; 12:
      if Password_length &lt; 6:
          Outputted_length = "too short"
          Outputted_criteria = "no shorter than 6 characters"
      else:
          Outputted_length = "too long"
          Outputted_criteria = "no longer than 12 characters"
      print("Your password is", Outputted_length, ". It has to be", Outputted_criteria, ".")
      Password = input("Please enter a password:")
      Password_length = len(Password)
  
      while Extended_presence:
          print("Your password contains characters from the extended ASCII list. Please don't use these.")
          Password = input("Please enter a password:")
          Extended_presence = hasExtended(Password)
  
  while Extended_presence:
      print("Your password contains characters from the extended ASCII list. Please don't use these.")
      Password = input("Please enter a password:")
      Extended_presence = hasExtended(Password)
  
      while Password_length &lt; 6 or Password_length &gt; 12:
          if Password_length &lt; 6:
              Outputted_length = "too short"
              Outputted_criteria = "no shorter than 6 characters"
          else:
              Outputted_length = "too long"
              Outputted_criteria = "no longer than 12 characters"
          print("Your password is", Outputted_length, ". It has to be", Outputted_criteria, ".")
          Password = input("Please enter a password:")
          Password_length = len(Password)
  else:
      #defines function for checking for presence of numbers
      def hasNumbers(s):
          return any(i.isdigit() for i in s)
      #defines function for checking for presence of letters
      def hasLetters(s):
          return any(i.isalpha() for i in s)
      #defines function for checking for presence of special characters
      def hasSpecial(s):
          return any(ord(i) &lt; 48 for i in s)
      #checks if password contains letters
      Letter_presence = hasLetters(Password)
      if not Letter_presence:
          Score = Score - 1
          Improvements.append("letters")
      else:
          Score = Score + 1
      #checks if password is all upper case
      Is_upper = Password.isupper()
      if not Is_upper:
          Score = Score + 1
      else:
          Score = Score - 1
          Improvements.append("upper and lower case letters")
      #checks if passwords is all lower case
      Is_lower = Password.islower()
      if not Is_lower:
          Score = Score + 1
      else:
          Score = Score - 1
          Improvements.append("upper and lower case letters")
      #checks if password contains a number
      Number_presence = hasNumbers(Password)
      if not Number_presence:
          Score = Score + 0
          Improvements.append("numbers")
      else:
          Score = Score + 1
      #checks if password is just numbers
      Only_numbers = Password.isdigit()
      if not Only_numbers:
          Score = Score + 0
      else:
          Score = Score - 1
          Improvements.append("other characters")
      #checks if password contains special characters
      Special_presence = hasSpecial(Password)
      if not Special_presence:
          Score = Score + 0
          Improvements.append("special characters, such as '$'")
      else:
          Score = Score + 1
      #outputs weak, medium or strong password to user and suggest improvements
      if Score &lt;= 2:
          print("The program is processing your password...")
          time.sleep(2)
          print("Your password isn't acceptable! Please try again.")
          print("Next time, remember to include", Improvements)
      if Score == 3:
          print("The program is processing your password...")
          time.sleep(2)
          print("Your password is weak, you should try again.")
          print("Next time, remember to include", Improvements)
      elif Score == 4:
          print("The program is processing your password...")
          time.sleep(2)
          print("Your password is medium, it should be OK.")
          print("Next time, remember to include", Improvements)
      elif Score == 5:
          print("The program is processing your password...")
          time.sleep(2)
          print("Your password is strong, it is absolutely fine.")
  </code></pre>