Email

We wish to automatically generate the email of a given professor according to its name, department and university. All of them are provided as a string with at most 3 capitalized words separated by ‘ ‘ (name and university are always 2 or 3 words whereas the department can also be single word). The generated email must have the following format:

  • The username: The name initials in lowercase followed by a number corresponding to the number of occurrences of the initial letter of the first name in the whole name. For instance if the name is 'Lluís Vila Grabulosa' the username is 'lvg4' since 'l' occurs 4 times in the name. Notice that both lowercase and capital letters and counted.

  • The @ symbol.

  • The domain: The initials of the departament and the initials of the university, both in lowercase and separated by '.'

  • The extension .edu

Implement the following two Python functionsin the module email (file email.py. Starting with the second one is recommended.

The first function is:

email(name, dep, uni)
takes name, dep, uni, str acording to the definition above
returns a str with the email corresponding to this person according to the description above.

For exemple:

>>> name = 'Lluis Vila Grabulosa'
>>> dep = 'Computer Science'
>>> uni = 'Universitat Politecnica Catalunya'

>>> email(name, dep, uni)
'lvg4@cs.upc.edu'

Doctests are available at the email-test.txt file.

This function must call the following function:

xtr_inis(s)

takes s a str formed by 1, 2 or 3 words separated by a ' '
returns a str with the initials in lowercase

For exemple:

>>> xtr_inis('Lluís Vila Grabulosa')
'lvg'
>>> xtr_inis('Computer Science')
'cs'
>>> xtr_inis('Universitat Politecnica Catalunya')
'upc'

Doctests are available at the xtr_inis-test.txt file.