<div dir="ltr"><div><div><div><div><div><div>Thanks to Jim, I found out about the divmod() built-in function.<br></div>help(divmod) returns:<br>divmod(...)<br>    divmod(x, y) -> (div, mod)<br>    <br>    Return the tuple ((x-x%y)/y, x%y).  Invariant: div*y + mod == x.<br><br></div><div>Basically, the function returns 2 values in a form of a tuple where the first value is the quotient and the 2nd value is the remainder.<br><br></div><div>example:<br></div><div>minutes, seconds = divmod(3600, 60)  # unpacking a tuple into 2 variables<br></div><div>minutes, seconds = (60, 0) or minutes = 60 and seconds = 0<br></div><div><br></div>divmod() came in handy when I tried to make a countdown timer which I am not ashamed of showing how terrible my code is:<br><a href="http://nbviewer.ipython.org/github/pybokeh/ipython_notebooks/blob/master/dates/CountDown.ipynb">http://nbviewer.ipython.org/github/pybokeh/ipython_notebooks/blob/master/dates/CountDown.ipynb</a><br><br></div><div>divmod() eliminated the need for me to handle the remainders of dividing up the years, hours, and minutes.  Very nice!<br></div><div><br></div>I was also curious what other built-in functions are available.  You can find out by doing:<br></div>import builtins<br></div>dir(builtins)<br></div><div><br></div>- Daniel<br></div>