Drop links or images here to add them to the editor.

An urn contains 75 white marbles and 150 black marbles. An inexhaustible pile of black marbles is also available. Repeatedly apply the following two-step operation: first withdraw two marbles at random from the urn, and then

Because the urn loses a marble at each step, eventually it will contain a single marble. What color is that last marble?

urn

Assignment

An urn containing $$w$$ white and $$b$$ black marbles is represented as a sequence (list or tuple) that contains $$w$$ occurrences of the string white (str) and $$b$$ occurrences of the string black (str). Although there is no predefined order of the marbles contained in the urn, its representation as a sequence imposes an order on the marbles that makes it possible to indicate a particular marble at a given position. Your task:

Example

>>> urn = fill(10)
>>> urn
['white', 'white', 'black', 'black', 'black', 'white', 'white', 'white', 'white', 'black']
>>> marble1, marble2 = pick(urn)
>>> marble1, marble2
(1, 9)
>>> remove(marble1, marble2, urn)
>>> urn
['white', 'black', 'black', 'black', 'white', 'white', 'white', 'white', 'white']
>>> last(urn)
'black'