[Solved] Compare one item of a dictionary to another item in a dictionary one by one [closed]


Assuming the keys (here, prompt) of both dictionaries are the same, or at least for every key in the answers dictionary, there is a matching response prompt, then you can count them like so

count = 0
for prompt, response in responses.items():
    if response == answers.get(prompt, None):
        count += 1
return count 

1

solved Compare one item of a dictionary to another item in a dictionary one by one [closed]