Skip to content

Commit 87c95d9

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b780d0b commit 87c95d9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

electronics/ohms_law.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
def ohms_law(voltage: float, current: float, resistance: float) -> dict[str, float]:
66
"""
77
Apply Ohm's Law to calculate the missing electrical value.
8-
8+
99
Ohm's Law: V = I × R, where V=voltage, I=current, R=resistance
10-
10+
1111
Args:
1212
voltage: Electrical potential difference in volts (0 if unknown)
13-
current: Electrical current in amperes (0 if unknown)
13+
current: Electrical current in amperes (0 if unknown)
1414
resistance: Electrical resistance in ohms (0 if unknown)
15-
15+
1616
Returns:
1717
Dictionary with the calculated value: {'voltage': V}, {'current': I}, or {'resistance': R}
18-
18+
1919
Raises:
2020
ValueError: If not exactly one value is 0, or if resistance is negative
21-
21+
2222
Examples:
2323
>>> ohms_law(voltage=10, resistance=5, current=0)
2424
{'current': 2.0}
@@ -64,4 +64,4 @@ def ohms_law(voltage: float, current: float, resistance: float) -> dict[str, flo
6464
if __name__ == "__main__":
6565
import doctest
6666

67-
doctest.testmod()
67+
doctest.testmod()

0 commit comments

Comments
 (0)