PRO
Nancy
asked

Expert
Kelish Rai answered
Yes, a dictionary can have a key with an empty value. Since "empty values" can be represented in different ways depending on what you're trying to express, two common options are:
my_dict = {"name": ""} # Empty string
my_dict = {"name": None} # None indicates the value is intentionally left empty or unknown
Both are valid, and which one you use depends on your intention. An empty string might mean "this was filled in but is blank", while None
often means "this hasn’t been set yet".
If you want to remove or reset the value without deleting the key itself, you don’t delete it—you just update it to an empty value:
my_dict["name"] = None
That way, the key "name"
still exists in the dictionary, but its value is clearly empty or unassigned.
This is useful when you want to preserve the structure of the data or signal that a value is missing but not lost.
Python
This question was asked as part of the Learn Python Basics course.