david jensen <dmj....@gmail.com> writes:
> Obviously, i can just write the code again, in an else, switching
> indices 0 and 1. Or, I could just have a test at the beginning, switch
> them if they are in the order "big, small", and then switch them again
> at the end in a list comprehension. Both ideas seem terribly silly,
> and there must be an obvious way to do it that I'm not seeing.

Generally when faced with this kind of question, see if you can
use the built-in min and max functions:

    def getOutcomes():
        outcomes=[]
        smaller = min(myList[0], myList[1])
        bigger  = max(myList[0], myList[1])
        amountToShare=2*smaller
        remainder = bigger - smaller
        ...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to