Call multiple dictionary in a print string, first using a loop to relate subject to verb

Viewed 89

I have this code which, thanks to a loop, relates the dictionary of a subject to the dictionary of a verb and prints it. The code works correctly. All good! The output is "Jessica è chiamatA alla prova del tris"

Name = {
"Jessica": {"gender" : "female", "quantity" : "singular"},
"David" : {"gender" : "male", "quantity" : "singular"}
}

dictionary_verbs = {
"è chiamata" : { "gender" : "female", "quantity" : "singular"},
"è chiamato" : { "gender" : "male", "quantity" : "singular"}
}

subject = "Jessica"

#Search verb in relation to the subject
verb = ""
for key, value in dictionary_verbs.items():
    if Name[subject] == value:
        verb= key
        break

phrase = (f"{verb} alla prova del tris")
print(phrase)

I am writing this question because I would like to replace the verb dictionary with the following dictionary, so as to group "è chiamato" and "è chiamata" inside the verb "chiamare". Consequently I would still like to call "verb" in the phrase, with the difference that through my loop it will now decide whether to use "è chiamato" or "è chiamata" simply by calling only "chiamare".

dictionary_verbs = { "chiamare": {"è chiamata" : { "gender" : "female", "quantity" : "singular"},
                                 "è chiamato" : { "gender" : "male", "quantity" : "singular"}},
                     #"other_verb": ...
                     #"other_verb": ...
                    }

I would like to get the output: Jessica è chiamata alla prova del tris

How can I do? I would always use the same mechanism that I already use with the loop. Thanks

0 Answers
Related