Consider the following python code: def carDict(data): d = dict() for c in data: if c not in d: d[c] = 1 else: d[c] += 1 return d cars = ['bmw', 'ford', 'toyota', 'ford', 'ford', 'bmw'] tracker =...


Consider the following python code:


def carDict(data):
    d = dict()
    for c in data:
        if c not in d:
            d[c] = 1
        else:
            d[c] += 1
    return d


cars = ['bmw', 'ford', 'toyota', 'ford', 'ford', 'bmw']
tracker = carDict(cars)


1) How would you iteratively print out all the key value pairs in the dictionary
tracker, using a loop?




Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here