You can probably use max and min from http://docs.python.org/2/library/functions.html