Answer:
While loop
Step-by-step explanation:
It should be noted that the number of times which the computer will ask the user to take a guess is not known.
When we have a condition like this, the while loop (or in some programs; the do-while loop) is to be used.
To further back my point, see the following program in python.
secret_code = 1234
user_guess = int(input("Take a guess: "))
while user_guess != secret_code:
user_guess = int(input("guess again: "))
print("You guessed right")
The above program will keep asking the user to take a guess until the user enters 1234.
This may or may not be possible with a for loop.