Drop links or images here to add them to the editor.

In a make task you use the skills you have learned to create a program from scratch. There is no starter code: you begin with an empty editor.

You are going to write the login check that guards a website. It asks for a username and a password, and it refuses to let go until the password is right.

Your task

Ask each question with its own print, and read the answer with a bare input() on the next line. Ask them with exactly this wording:

Enter your username:
Enter your password:

The output

Every question is printed exactly as written above, so your program’s output is not just Login accepted: it is the username question, the password question, one more password question for every wrong attempt, and finally the acceptance message. For example, with one wrong attempt before the right password:

Enter your username:
Enter your password:
Enter your password:
Login accepted

A wrong password otherwise produces no extra output of its own: the user simply gets asked again, and nothing but the repeated question appears until the password is right.

Example

Input:

Ben
abc123

Output:

Enter your username:
Enter your password:
Login accepted

The next example gets the password wrong three times before getting it right. The first line is still the username, and every line after it is an attempt at the password:

Input:

Dev
123abc
ABC123
abcd123
abc123

Output:

Enter your username:
Enter your password:
Enter your password:
Enter your password:
Enter your password:
Login accepted

The password is compared with !=, so the match has to be exact. ABC123 is not abc123, and neither is abc1234, so both of those count as wrong attempts.

The two questions are part of the output that is checked here, so their spelling, capital letters and punctuation count. Ask each one with its own print, exactly Enter your username: and Enter your password:, and read the answer with a bare input() on the next line, rather than passing the question to input(...).

Help! My code doesn't work!

Make sure that you check for the following things:

  • Iteration begins with while.
  • The while line has a condition.
  • The while line has a colon (:) at the end.
  • All the code you want to repeat is indented after the while, and all of it by the same amount. Never mix tabs and spaces in one file.
  • Any code that should run once the loop has finished is not indented, so Login accepted is printed once rather than every time round the loop.
  • There is a password question and an input line inside the loop as well as before it. Without them the user never gets another chance to type, so the condition can never change and the loop never ends.
  • The password abc123 is spelled exactly that way, in speech marks, everywhere it appears.