Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 25, 2024
1 parent a1183b8 commit 188ca6a
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions docs/user-guide/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ Python
==================
The Python wrapper for the units library is a simplified version of the library. It is focused on the string operations of the library and conversions between units and measurements.

The units library is available through a pypi package
The units library is available through a pypi package

.. code-block:: sh
pip install units-llnl
Usage
Usage
-----------

.. code-block:: python
from units_llnl import Unit
u1 = Unit('m')
u2 = Unit('s')
u3=u1/u2
speed=20
desired='mph'
u1 = Unit("m")
u2 = Unit("s")
u3 = u1 / u2
speed = 20
desired = "mph"
# convert the unit to miles per hour
result = u3.convert(speed,desired)
result = u3.convert(speed, desired)
print(f"{20} {u3} = {result} {desired}")
This will print a result `20 m/s = 44.73872584108805 mph`
Expand All @@ -31,10 +31,10 @@ This will print a result `20 m/s = 44.73872584108805 mph`
from units_llnl import Measurement
m1 = Measurement('220 m')
m2 = Measurement('11 s')
m3=m1/m2
desired='mph'
m1 = Measurement("220 m")
m2 = Measurement("11 s")
m3 = m1 / m2
desired = "mph"
# convert the unit to miles per hour
result = m3.convert_to(desired)
print(f"{m3} = {result}")
Expand All @@ -46,4 +46,3 @@ See the pypi_ for a complete description of all methods and functions
.. _pypi: https://pypi.org/project/units-llnl/

Future expansions will include uncertain units and some additional math operations on measurements

0 comments on commit 188ca6a

Please sign in to comment.