Learning how to handle adversity