def expand_memory(self, addr):
    needed_mem = (addr - (len(self.memory) - 1))
    if (needed_mem > 0):
        self.memory += ([self.INIT_VAL] * needed_mem)
    else:
        raise Exception(f'Cannot expand memory for addr {addr}')
def expand_memory(self, addr):
    needed_mem = (addr - (len(self.memory) - 1))
    if (needed_mem > 0):
        self.memory += ([self.INIT_VAL] * needed_mem)
    else:
        raise Exception(f'Cannot expand memory for addr {addr}')