loops of any kind, lists, or is not allowed. At the Academy of Crime Fighting, each trainee is recognized by a unique 5-digit identifier. The identifier can have any of the following digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The identifier can have leading 0s. Since Drew the owl has trouble typing numbers, the school makes things easier by ensuring that each successive digit in the identifier
Python Language]
Using loops of any kind, lists, or is not allowed.
At the Academy of Crime Fighting, each trainee is recognized by a unique 5-digit identifier. The identifier can have any of the following digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The identifier can have leading 0s.
Since Drew the owl has trouble typing numbers, the school makes things easier by ensuring that each successive digit in the identifier is either one digit greater or one digit less than the previous digit. For example, if the first digit is 3, then the successive digit would be 4 or 2. So, 32345 would be a valid trainee identifier, but 32435 would NOT be a valid identifier because the third digit 4 is two digits away from the previous digit 2.
Your task is to write a program that validates an identifier.
Input
The input consists of five lines; the first line is the first digit of the trainee identifier, the second line is the second digit of the trainee identifier, and so on.
Output
If the trainee identifier is valid, print VALID. Otherwise, print INVALID.
Sample Input 1
5 4 3 4 5
Sample Output 1
VALID
Sample Input 2
5 6 7 5 6
Sample Output 2
INVALID
Sample Input 3
1 2 3 4 9
Sample Output 3
INVALID
Step by step
Solved in 3 steps with 3 images