Python sample question with answer 17

Question:
You want to print a message that tells the user to “try again” as long as the value of the attempt variable is 5 or less, and you want to increase the value of this variable by 1 each time it passes through the loop.
Iterative statement

  1. attempt = 1
    while attempt < 5:
      print("Try again.")
      attempt = attempt + 1
  2. attempt = 1
    while attempt != 5:
      print("Try again.")
  3. attempt = 1
    while attempt <= 5:
      print("Try again.")
  4. attempt = 1
    while attempt <= 5:
      print("Try again.")
      attempt = attempt + 1
Answer:
D - is the correct answer