Electronic mail =============== Save all functions into the same file named ``emails.py``. #. Write the function :py:func:`address1` that takes a first name and a last name (strings), and returns an e-mail address following the pattern: ``first.last@student.upc.edu``. Examples: .. literalinclude:: test-emails1.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-emails1.txt` file. #. Write the function :py:func:`address2` that takes a first name and a last name (strings), and returns an e-mail address following the pattern seen in the previous exercice but with a maximum of 10 characters allowed for the first name and a maximum of 15 characters for the last name (in both cases the first characters will be selected). Examples: .. literalinclude:: test-emails2.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-emails2.txt` file. #. Write the function :py:func:`valid_address` that takes an e-mail address (string), and returns ``True`` if it is a valid address and ``False`` otherwise. A string represents a valid address if it contains one and only one '@' symbol and there are at least 2 characters on the left of the '@' symbol. Examples: .. literalinclude:: test-emails3.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-emails3.txt` file. #. Write the function :py:func:`generate_password` that takes a first name, a last name and a dni (3 strings), and returns a password with the first three characters of the first name, then the first three characters of the last name and the two last digits of the dni. Examples: .. literalinclude:: test-emails4.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-emails4.txt` file. .. rubric:: Solutions A solution of these functions is provided in the :download:`emails.py` file.