Upper Unitari Letters

You are required to deliver the following function in the module upper_module (file upper_module.py):

upper_uni(text, ref)

such that

given
  • text, str of characters

  • ref, str of lowercase letters

returns a str like text where
  • all letters, either occurring only once or appearing in ref, are in upper case.

  • all characters that are not aphanumeric are deleted.

For example:


>>> upper_uni('plou pero plou poc pero pel poc que plou, plou prou.', 'p')
'PlouPeroPlouPocPeroPelPocQuePlouPlouProu'

Observe in the resulting string that:

  • all 'p' are in upper case since it appears in the string of the second parameter (ref),

  • 'q' is also in upper case since it occurs only once,

  • all digits remain untouched

  • All spaces ' ', comas ',' dots and '.' have been removed.

Doctests are available in the upper_uni.test file.