A programmer is writing a Python program to validate that a newly entered password is between 8 and 20 characters inclusive.
Figure 1 shows the corrected version of the code.
1 password = input("Enter password: ")
2 passLength = len(password)
3 while passLength < 8 or passLength > 20:
4 print("Invalid password length")
5 password = input("Enter password: ")
6 print("Password length is valid")
In an earlier draft of the program, line 3 contained one syntax error and one logic error:
whlie passLength <= 8 or passLength > 20:
Complete the table to describe the syntax error and the logic error in this earlier draft of line 3.
| Error Type | Description |
|---|---|
| Syntax Error | |
| Logic Error |
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.