<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assignment(self, index):
 """ Returns a list of assignments for the corresponding index. Parameters index: list, array-like List of indices whose assignment is to be computed Returns ------- list: Returns a list of full assignments of all the variables of the factor. Examples -------- [[('diff', 0), ('intel', 1)], [('diff', 1), ('intel', 0)]] """

        index = np.array(index)

        max_possible_index = np.prod(self.cardinality) - 1
        if not all(i <= max_possible_index for i in index):
            raise IndexError("Index greater than max possible index")

        assignments = np.zeros((len(index), len(self.scope())), dtype=np.int)
        rev_card = self.cardinality[::-1]
        for i, card in enumerate(rev_card):
            assignments[:, i] = index % card
            index = index // card

        assignments = assignments[:, ::-1]

        return [[(key, val) for key, val in zip(self.variables, values)] for values in assignments]