Skip to main content

python3 library for Ohms law.

Project description

ohmslaw

PyPI - Downloads PyPI - License Documentation Status GitHub Tag

Python3 library for calculations using Ohm's law

Ohms law is an important and fundamental rule to remember when working with resistors and electronics in general. It defines the relationship between the components’ current I in amps (A), voltage V in volts (V) and resistance R in ohms (Ω). Ohm’s law consists of three mathematical equations that explain the relationship between current, voltage and resistance. If you know two of these values.

Quickstart:

install

pip install ohmslaw

import

from ohmslaw import Ohms

you can calculate the resistors in series, passing the values ​​in the series() method

>>> from ohmslaw import Ohms
>>>
>>> R1, R2, R3 = 280, 450, 100
>>>
>>> o = Ohms()
>>> series = o.series(R1, R2, R3)
>>>
>>> print("Resistors in series = ", series)
Resistors in series =  830
>>>

current multiplied by resistance = voltage

>>> o = Ohms()
>>> results = o.volts(I=12, R=4)
>>> 
>>> print(results)
48
>>> 

voltage Divided by resistance = current

>>> o = Ohms()
>>> results = o.current(V=12, R=4)
>>> 
>>> print(results)
3.0
>>> 

voltage divided by current = resistance

>>> o = Ohms()
>>> results = o.resistance(V=48, I=4)
>>> 
>>> print(results)
12.0
>>> 

Watts

>>> o = Ohms()
>>> results = o.watts(I=2, R=15)
>>> 
>>> print(results)
60
>>> 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ohmslaw-2.0rc1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

ohmslaw-2.0rc1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file ohmslaw-2.0rc1.tar.gz.

File metadata

  • Download URL: ohmslaw-2.0rc1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.6

File hashes

Hashes for ohmslaw-2.0rc1.tar.gz
Algorithm Hash digest
SHA256 79d8bb6542cb070a6e50e2b7c8ec90a04ad56ddc791ccf369b1b938daa440768
MD5 a3e54346b74741fb71584545fe7c175d
BLAKE2b-256 8b11291e910fd219fec9d92d32bf51436b5a10cabc65ded44ac84e65e13d9877

See more details on using hashes here.

File details

Details for the file ohmslaw-2.0rc1-py3-none-any.whl.

File metadata

  • Download URL: ohmslaw-2.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.6

File hashes

Hashes for ohmslaw-2.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 a53ffc81caa722ab047662f2cb048a1be93ebf661150c320823df93864337df2
MD5 a2c7d5a1f0fe92ba01ab2fcfe4f0b812
BLAKE2b-256 9e3740d1e302f32a91d9823c7ce5930db465138fd93e347ef7d3bf221c9179ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page