Skip to content

Ohm's Law algorithm added #3934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 25, 2020
Merged
Next Next commit
New algorithm added
  • Loading branch information
erdum committed Nov 22, 2020
commit 3986d64af1a20ec9244331439b520c894528af4c
13 changes: 13 additions & 0 deletions Electronics/ohms_law.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Defining function
def ohms_law(v: float = 0, i: float = 0, r: float = 0) -> float:
if v == 0:
result = i * r
return result
elif i == 0:
result = v / r
return result
elif r == 0:
result = v / i
return result
else:
return 0