CJCoding With Joseph
15free / daySign inCreate account

Three Tries For The Password

The password is open-sesame and the user gets at most three attempts. Each attempt reads a line with the prompt Password: ; a correct guess prints Welcome in. and ends the attempts, a wrong one prints Wrong password.. When all three fail, print Locked out. on its own line after the loop. The attempts counter and the unlocked flag in the loop condition stop the loop, so no break is needed. Input: one guess per line, up to three. Prompts are part of the output.

Expected Output:

Password: Welcome in.

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Menus & Validation
📥 Auto-Input:
open-sesame\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.