We want to keep asking until the user types 'secret'. This requires input inside the loop and proper exit condition.
Step 2: Analyze each option
password = ''\nwhile password != 'secret':\n password = input('Enter password: ')
print('Access granted') initializes empty password, checks condition, inputs inside loop, updates, and exits when equal to 'secret'. while true:\n password = input('Enter password: ')
if password == 'secret':\n break
print('Access granted') uses 'true' which is undefined in Python (must be 'True'), causing NameError. for password in ['secret']:\n input('Enter password: ')
print('Access granted') uses for loop incorrectly, runs fixed once without checking input. password = input('Enter password: ')
while password == 'secret':
print('Access granted') inputs once then loops only if correct, fails to re-ask on wrong.