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.1.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

ohmslaw-2.1.2-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file ohmslaw-2.1.2.tar.gz.

File metadata

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

File hashes

Hashes for ohmslaw-2.1.2.tar.gz
Algorithm Hash digest
SHA256 131f5e5836069eeb4a9543889e4d0552c7f37e944210c1ac5c75e33eec770d8d
MD5 f0b30c2125e66ba2f07c0526a8de49b5
BLAKE2b-256 06165af7f5ba1c068aa43b16aae9acfbcf489b3e5beb48f2691182ecd993932e

See more details on using hashes here.

File details

Details for the file ohmslaw-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: ohmslaw-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.6 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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d93b48cd6393ac74f271f66ed329ec478c9681c501e6211e93149ccbc3401aa
MD5 c2be7cd95ac97b2d190c93b078021ced
BLAKE2b-256 c95412d017b884170f2a79df489db03dc9d609836bc22ddfd1d8781e81837453

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