Login and get codingYou are given a list of
operas
and a list ofcomposers
. For two given composers find operas (where one of the composers is the author) at which premiere both could have been together (i.e. they both had to be alive). Consider just a theoretical possibility of presence, so omit health condition, traveling problems, resources, and any other problems (excluding death) which could restrict their presence.The list of
operas
consists ofnamedtuple('Opera', 'author play date')
objects. The list ofcomposers
contains dictionaries with keys => composer names and values =>namedtuple('Composer', 'name born died')
objects.Complete the
operas_both_at_premiere(guest, composers)
function. Parameters:guest - one of the composers but not the author of an opera composer - the author of an operaIf the required composer or guest is not in the list of composers, raise a
ValueError
exception. You can use the_get_date
helper to convert date strings intodatetime
objects.Return a
list
(or generator) of titles of operas. See the tests for more information.
Note that the list of operas in the Bite is shortened.
Sources:
https://en.wikipedia.org/wiki/List_of_operas_by_Wolfgang_Amadeus_Mozart https://en.wikipedia.org/wiki/List_of_compositions_by_Ludwig_van_Beethoven https://en.wikipedia.org/wiki/List_of_works_for_the_stage_by_Richard_Wagner https://en.wikipedia.org/wiki/List_of_compositions_by_Giuseppe_Verdi
Will you be the 133rd person to crack this Bite?
Resolution time: ~53 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 4.38 on a 1-10 difficulty scale.
» Up for a challenge? 💪