alchemist/laboratory.py
def update_shelves(self, substance_lower, substance_upper_index):
        """Update the shelves by removing the substances reacting

        Removes the substances from the upper and lower shelves if a reaction
        takes place. Note that this does not check itself if the substances can
        react, but will remove them regardless of what is passed in.
        :param substance_lower: string specifying a substance on lower shelf
        :param substance_upper_index: integer specifying the index of a
        substance on upper shelf (0-indexed)

        :return: tuple of two lists of the new updated lower and upper shelves
        in the lab
        """
        if substance_lower not in self.shelves["lower"]:
            raise ValueError(
                "The substance {} is not the lower shelf.".format(
                    substance_lower
                )
            )
        if substance_upper_index < 0 or substance_upper_index >= len(
            self.shelves["upper"]
        ):
            raise IndexError(
                "The index {} is out of range.".format(substance_upper_index)
            )
        index_lower = self.shelves["lower"].index(substance_lower)
        self.shelves["lower"] = (
            self.shelves["lower"][:index_lower]
            + self.shelves["lower"][index_lower + 1:]
        )
        self.shelves["upper"] = (
            self.shelves["upper"][:substance_upper_index]
            + self.shelves["upper"][substance_upper_index + 1:]
        )
Update the shelves by removing the substances reacting

        Removes the substances from the upper and lower shelves if a reaction
        takes place. Note that this does not check itself if the substances can
        react, but will remove them regardless of what is passed in.
        :param substance_lower: string specifying a substance on lower shelf
        :param substance_upper_index: integer specifying the index of a
        substance on upper shelf (0-indexed)

        :return: tuple of two lists of the new updated lower and upper shelves
        in the lab
        
Update the shelves by removing the substances reacting
Removes the substances from the upper and lower shelves if a reaction
takes place. Note that this does not check itself if the substances can
react, but will remove them regardless of what is passed in.
Update the shelves by removing the substances reacting Removes the substances from the upper and lower shelves if a reaction takes place . Note that this does not check itself if the substances can react but will remove them regardless of what is passed in .
def update_shelves(self, substance_lower, substance_upper_index):
        if substance_lower not in self.shelves["lower"]:
            raise ValueError(
                "The substance {} is not the lower shelf.".format(
                    substance_lower
                )
            )
        if substance_upper_index < 0 or substance_upper_index >= len(
            self.shelves["upper"]
        ):
            raise IndexError(
                "The index {} is out of range.".format(substance_upper_index)
            )
        index_lower = self.shelves["lower"].index(substance_lower)
        self.shelves["lower"] = (
            self.shelves["lower"][:index_lower]
            + self.shelves["lower"][index_lower + 1:]
        )
        self.shelves["upper"] = (
            self.shelves["upper"][:substance_upper_index]
            + self.shelves["upper"][substance_upper_index + 1:]
        )
def update_shelves ( self , substance_lower , substance_upper_index ) : if substance_lower not in self . shelves [ "lower" ] : raise ValueError ( "The substance {} is not the lower shelf." . format ( substance_lower ) ) if substance_upper_index < 0 or substance_upper_index >= len ( self . shelves [ "upper" ] ) : raise IndexError ( "The index {} is out of range." . format ( substance_upper_index ) ) index_lower = self . shelves [ "lower" ] . index ( substance_lower ) self . shelves [ "lower" ] = ( self . shelves [ "lower" ] [ : index_lower ] + self . shelves [ "lower" ] [ index_lower + 1 : ] ) self . shelves [ "upper" ] = ( self . shelves [ "upper" ] [ : substance_upper_index ] + self . shelves [ "upper" ] [ substance_upper_index + 1 : ] )
Update the shelves by removing the substances reacting
Removes the substances from the upper and lower shelves if a reaction
takes place.
Update the shelves by removing the substances reacting Removes the substances from the upper and lower shelves if a reaction takes place .
"""Update the shelves by removing the substances reacting

        Removes the substances from the upper and lower shelves if a reaction
        takes place. Note that this does not check itself if the substances can
        react, but will remove them regardless of what is passed in.
        :param substance_lower: string specifying a substance on lower shelf
        :param substance_upper_index: integer specifying the index of a
        substance on upper shelf (0-indexed)

        :return: tuple of two lists of the new updated lower and upper shelves
        in the lab
        """
tuple of two lists of the new updated lower and upper shelves
in the lab
tuple of two lists of the new updated lower and upper shelves in the lab
self
substance_lower
string specifying a substance on lower shelf
string specifying a substance on lower shelf
substance_upper_index
integer specifying the index of a
substance on upper shelf (0-indexed)
integer specifying the index of a substance on upper shelf ( 0 - indexed )