def add_variable(self, variable, card=0):
        """
        Add a variable to the model.

        Parameters:
        -----------
        variable: any hashable python object

        card: int
            Representing the cardinality of the variable to be added.

        Examples:
        ---------
        >>> from pgmpy.models import MarkovChain as MC
        >>> model = MC()
        >>> model.add_variable('x', 4)
        """
        if variable not in self.variables:
            self.variables.append(variable)
        else:
            warn('Variable {var} already exists.'.format(var=variable))
        self.cardinalities[variable] = card
        self.transition_models[variable] = {}
Add a variable to the model.

        Parameters:
        -----------
        variable: any hashable python object

        card: int
            Representing the cardinality of the variable to be added.

        Examples:
        ---------
        >>> from pgmpy.models import MarkovChain as MC
        >>> model = MC()
        >>> model.add_variable('x', 4)