Conversions =========== Save all functions into the same file named ``conversions.py``. #. Write the function :py:func:`seconds` that takes a time expressed in hours, minutes and seconds, and returns the same time value expressed in total seconds. See the following examples: .. literalinclude:: seconds.txt :language: python3 :lines: 3-11 .. note:: More tests are provided in the :download:`seconds.txt` file. #. Write a function :py:func:`hms` that takes a time expressed in seconds, and returns the same time value expressed in hours, minutes and seconds. See the following examples: .. literalinclude:: hms.txt :language: python3 :lines: 3-9 .. note:: More tests are provided in a function :download:`hms.txt` file. #. Write a function :py:func:`kp_to_newtons` that takes a weight expressed in kiloponds, and returns the same value expressed in Newtons. See the following examples: .. literalinclude:: kp_to_newtons.txt :language: python3 :lines: 3-9 .. note:: More tests are provided in the :download:`kp_to_newtons.txt` file. #. Write a function :py:func:`miles_to_meters` that takes a distance expressed in miles, and returns the same distance expressed in meters. See the following examples: .. literalinclude:: miles_to_meters.txt :language: python3 :lines: 3-9 .. note:: More tests are provided in the :download:`miles_to_meters.txt` file. #. Write a function :py:func:`convert` that takes length expressed in meters (integer), and returns the same length expressed in Km, Hm, Dm and m. See the following examples: .. literalinclude:: convert.txt :language: python3 :lines: 3-11 .. note:: More tests are provided in the :download:`convert.txt` file. #. Write a function :py:func:`celsius_to_fahrenheit` that takes a temperature expressed in degrees Celsius, and returns the same temperature expressed in degrees Fahrenheit. See the following examples: .. literalinclude:: celsius_to_fahrenheit.txt :language: python3 :lines: 3-11 .. note:: More tests are provided in the :download:`celsius_to_fahrenheit.txt` file. #. Write a function :py:func:`celsius_to_kelvin` that takes a temperature expressed in degrees Celsius, and returns the same temperature expressed in degrees Kelvin. See the following examples: .. literalinclude:: celsius_to_kelvin.txt :language: python3 :lines: 3-11 .. note:: More tests are provided in the :download:`celsius_to_kelvin.txt` file. #. Write a function :py:func:`degrees_to_radians` that takes an angle expressed in degrees, and returns the same angle expressed in radians. Look up in the math library for related functions and compare the results. See the following examples: .. literalinclude:: degrees_to_radians.txt :language: python3 :lines: 3-11 .. note:: More tests are provided in the :download:`degrees_to_radians.txt` file. .. rubric:: Solutions A solution of these functions is provided in the :download:`conversions.py` file.