(word2nums, num2words, word)
return sorted(syns)
Uses the word2nums and num2words dicts to look up synonyms
    for the given word. Returns a list of synonym strings.
Uses the word2nums and num2words dicts to look up synonyms
    for the given word. Returns a list of synonym strings.
Uses the word2nums and num2words dicts to look up synonyms for the given word . Returns a list of synonym strings .
def synonyms(word2nums, num2words, word):
    """Uses the word2nums and num2words dicts to look up synonyms
    for the given word. Returns a list of synonym strings.
    """

    keys = word2nums[word]
    syns = set()
    for key in keys:
        syns = syns.union(num2words[key])

    if word in syns:
        syns.remove(word)
    return sorted(syns)
def synonyms ( word2nums , num2words , word ) : keys = word2nums [ word ] syns = set ( ) for key in keys : syns = syns . union ( num2words [ key ] ) if word in syns : syns . remove ( word ) return sorted ( syns )