Test 1 Spring 2017
- Test Date: Friday, February 10, 2017
- Test Duration: 50 minutes
- Test Location: In class
- Computer is permitted. Open notes.
Problem 1 (90 points):
Write a function: validPlate that has one
parameter - string of
characters. The function returns True if the string is a valid Car
License Plate in some State in USA,
and False otherwise.
The rules for the valid license plate are:
- Length must be 7 characters
- Must be combination of upper case letters and digits ONLY
- The plate must include at least one letter
- Combinations that consist of six numbers followed by one letter are
NOT VALID.
- Use of the letter "I" as the first or/and last characters on a plate
when the other characters are all numbers are NOT VALID.
For example:
YANa1234 - NOT VALID (has lower case letter)
I12345I - NOT VALID (has letter "I" as first and last and other chars
are all digits)
1234567 - NOT VALID (doesn't have any letters)
123456A - NOT VALID (6 numbers followed by one letter is not permitted)
123A456 - VALID
123I3I6 - VALID
YANA-123 - NOT VALID (has special char)
IA3B4CI - VALID
I123456 - NOT VALID (has letter "I" as first and all other digits)
123456I - NOT VALID (has letter "I" as last and all other digits)
Write main to test your function. In my examples I indicated the reason
for validity/not validity.
That
was done for explanation purposes only. Your program doesn't need to
explain the reason for validity/not
validity.
Problem 2 (10 points):
Write a program that randomly
generates a list of integers. The program finds an average of the list
elements and creates two lists: list of all numbers above average from
original list and list of all numbers below average from original list.
Design: