Email¶
We wish to automatically generate the email of a given professor according to its name, department and university:
The name is provided as a string with 2 or 3 words separated by ‘.’
The department and the university are provided as a string with at most 3 words separated by ‘ ‘ (it can be a single word).
The generated email must have the following format:
The username: The first two letters of each of the words in its name, in lowercase. For instance if the name is
'Lluís Vila Grabulosa'the username is'llvigr'.The
@symbol.The domain formed with two words separated by
'.': The first three letters of each of the words of the departament and the initials of the university, both in lowercase.The extension
.edu.
Implement the following two Python functions in the module email (file email.py. Starting with the second one is recommended.
The first function is:
For exemple:
>>> name = 'Lluis.Vila.Gra' >>> dep = 'Computer Science' >>> uni = 'Universitat Politecnica Catalunya' >>> email(name, dep, uni) 'llvigr@comsci.upc.edu'
Doctests are available at the email-test.txt file.
This function must call the following function:
For exemple:
>>> xtr_inis('Lluís.Vila.Gra', '.', 2) 'llvigr' >>> xtr_inis('Computer Science', ' ', 3) 'comsci' >>> xtr_inis('Universitat Politecnica Catalunya', ' ', 1) 'upc'
Doctests are available at the xtr_inis-test.txt file.