'How to check if (key belongs to value/value belongs to key)

I can't figure out how to check if the answer is right.

import random
elements = {"Co":"cobaltum",
            "C":"Carboneum"}
question = random.choice(list(elements.keys()))
print(question)
answer=input("What is the full name of this element? ")


Solution 1:[1]

Perhaps:

if answer == elements[question]:
  print("you're right!")

...I think that's what you're asking. Basically you can access the value of a key in a dictionary like

myDict[key] # value

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris