Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1len(pin) == 4 | AChecks that the password is at least 8 characters long | |
| 2len(password) >= 8 | BUsing > means an 8-character password is rejected. For a minimum of 8 it should be len(password) >= 8. | |
| 3Accept a username only if it has no more than 12 characters (maximum length) | Cif len(pin) != 4: | |
| 4Reject a PIN that is not exactly 4 characters long | Dif len(username) <= 12: | |
| 5if pin == 4: | EChecks that the PIN is exactly 4 characters long | |
| 6if len(password) > 8: | FThe PIN text is compared directly with the number 4. It should compare its length: len(pin) == 4. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
len(pin) == 4 — A length check compares len() of the text with a required length or limit, such as exactly 4 characters for a PIN, to accept or reject the input.if len(pin) == 4:if len(pin) == 4:if len(password) >= 8:valid = len(username) <= 12pin = input("Enter 4-digit PIN: ")
if len(pin) == 4:
print("PIN accepted")