Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update wheatstone_bridge.py
  • Loading branch information
Aroson1 authored Oct 5, 2023
commit 11cdfae20104cc0f75b3a0d6e0c3a411774ec75f
5 changes: 2 additions & 3 deletions electronics/wheatstone_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def wheatstone_solver(
resistance_1: float, resistance_2: float, resistance_3: float
) -> tuple:
) -> float:
"""
This function can calculate the unknown resistance in an wheatstone network.

Expand All @@ -26,11 +26,10 @@ def wheatstone_solver(
if resistance_1 <= 0 or resistance_2 <= 0 or resistance_3 <= 0:
raise ValueError("All resistance values must be positive")
else:
return (resistance_2 / resistance_1) * resistance_3
return float((resistance_2 / resistance_1) * resistance_3)


if __name__ == "__main__":
import doctest

doctest.testmod()
# print(wheatstone_solver(356,234,976))