# Sample dictionary
my_dict = {
"name": "Rahul",
"age": 25,
"city": "Mumbai"
}
# Key to check
key_to_check = "age"
# Check if key exists
if key_to_check in my_dict:
print(f"Key '{key_to_check}' exists in the dictionary.")
else:
print(f"Key '{key_to_check}' does not exist in the dictionary.")
Comments
Post a Comment