Number plate ============ We represent a car registration as a string with four digits followed by a whitespace character and three consonant capital letters. Save all functions into the same file named ``numberplate.py``. #. Write the function :py:func:`pos_letter` that takes a number plate (string) and another string with one character, and returns the first position of this character within the three letters group of the number plate. If this character is different from all three letters then the function will return -1. Examples: .. literalinclude:: test-numberplate1.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-numberplate1.txt` file. #. Write the function :py:func:`only_digits` that takes a number plate (string), and returns ``True`` if the first four characters of the number plate are digits and ``False`` otherwise. Examples: .. literalinclude:: test-numberplate2.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-numberplate2.txt` file. #. Write function :py:func:`is_upper_consonant` that given a string with one character returns ``True`` if this character is a uppercase consonant letter and ``False`` otherwise. Examples: .. literalinclude:: test-numberplate5.txt :language: python3 :lines: 3-10 .. note:: More tests are provided in the :download:`test-numberplate5.txt` file. #. Write the function :py:func:`only_consonants` that takes a number plate (string), and returns ``True`` if the last three characters of the number plate are consonant capital letters and ``False`` otherwise. One way of designing this function is by using function :py:func:`is_upper_consonant`. Example: .. literalinclude:: test-numberplate3.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-numberplate3.txt` file. #. Write the function :py:func:`correct_numberplate` that takes a number plate (string), and returns ``True`` if the number plate is correct (see definition at the beginning) and ``False`` otherwise. **This function must call some of the previous functions**. See the following examples: .. literalinclude:: test-numberplate4.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-numberplate4.txt` file. .. rubric:: Solutions A solution of these functions is provided in the :download:`numberplate.py` file.