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.0rc2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ohmslaw-2.0rc2.tar.gz
Algorithm Hash digest
SHA256 b1dd10fc3f08dda89ec05e8e40da16a30bb57991b60c29e316ddf47a52a64827
MD5 6ec5b8c242ca4515f55c53dd7cb73bdb
BLAKE2b-256 a9364a019182255c72d2e71ef5c711d5a64b87f0a67bdac3dc2da3464ae25653

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ohmslaw-2.0rc2-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.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 f2bbd0cdb9ba1e075ed052f9911cb35e3be6fc352448f3c92f4a48d3e88f5948
MD5 22e92d8c89afd363d3db4920878200bf
BLAKE2b-256 0f75145ee1caa4204e68f04c3cd2451d3ef55b9b589bbd8c350a7123b6d65643

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