logo CodeStepByStep logo


Language/Type: Python collection mystery collections

Write the output that is printed when the given function below is passed each of the following dictionaries as its parameter. Your answer should display the right keys and values in the order they are added to the result dictionary.

def collection_mystery1(map):
    result = {}
    for k in map.keys():
        v = map[k]
        if k[0] <= v[0]:
            result[k] = v
            result[v] = k
{'two': 'deux', 'five': 'cinq', 'one': 'un', 'three': 'trois', 'four': 'quatre'}
{'skate': 'board', 'drive': 'car', 'program': 'computer', 'play': 'computer'}
{'siskel': 'ebert', 'girl': 'boy', 'heads': 'tails', 'ready': 'begin', 'first': 'last', 'begin': 'end'}
{'cotton': 'shirt', 'tree': 'violin', 'seed': 'tree', 'light': 'tree', 'rain': 'cotton'}

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.