Code in Python and Ruby