class Solution:

def __init__(self, capacity: int):
    # write code here
    self.capacity = capacity
    self.lru_dict = dict()
    self.lru_list = list()

def get(self, key: int) -> int:
    # write code here
    if key not in self.lru_list:
        return -1
    self.lru_list.remove(key)
    self.lru_list.append(key)
    return self.lru_dict[key]

def set(self, key: int, value: int) -> None:
    # write code here
    if len(self.lru_list) < self.capacity and key not in self.lru_list:
        self.lru_list.append(key)
    else:
        pop_key = self.lru_list.pop(0)
        self.lru_dict.pop(pop_key)
        self.lru_list.append(key)
    self.lru_dict[key] = value
    return None

Your Solution object will be instantiated and called as such:

solution = Solution(capacity)

output = solution.get(key)

solution.set(key,value)