Complete the code to define the main component of a key-value store system.
class [1]Store: def __init__(self): self.store = {}
The main component is called a KeyValueStore because it stores data as key-value pairs.
Complete the code to add a method that stores a value by key.
def put(self, [1], value): self.store[key] = value
The method parameter should be named 'key' to represent the key where the value is stored.
Fix the error in the method that retrieves a value by key.
def get(self, [1]): return self.store.get(key, None)
The parameter must be named 'key' to match the usage inside the method.
Fill both blanks to implement a method that deletes a key-value pair safely.
def delete(self, [1]): if [2] in self.store: del self.store[key]
Both blanks should be 'key' to check and delete the key from the store.
Fill all three blanks to implement a method that returns all keys with values greater than a threshold.
def keys_above(self, [1]): return [k for k, v in self.store.items() if v [2] [3]]
The method takes a threshold, and returns keys where values are greater than the threshold.
