# Initialize an empty hash table
hash_table = {}
# Add key-value pairs to the hash table
hash_table["key1"] = "value1"
hash_table["key2"] = "value2"
hash_table["key3"] = "value3"
# Access the values using the keys
print(hash_table["key1"]) # Output: value1
print(hash_table["key2"]) # Output: value2
print(hash_table["key3"]) # Output: value3
# Check if a key exists in the hash table
if "key2" in hash_table:
print("Key2 exists in the hash table") # Output: Key2 exists in the hash table
# Remove a key-value pair from the hash table
del hash_table["key3"]
# Update the value for a key
hash_table["key1"] = "updated value1"
# Display the updated hash table
print(hash_table) # Output: {'key1': 'updated value1', 'key2': 'value2'}