From 42a054f491a066f323c4203e7ed7bf27132a5f5b Mon Sep 17 00:00:00 2001 From: Sharanya S Date: Sun, 15 Feb 2026 12:59:26 +0530 Subject: [PATCH 1/4] docs: Add circuit diagram and improve Wheatstone bridge documentation --- electronics/wheatstone_bridge.py | 33 +++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/electronics/wheatstone_bridge.py b/electronics/wheatstone_bridge.py index 3529a09339c4..544ea51b1fce 100644 --- a/electronics/wheatstone_bridge.py +++ b/electronics/wheatstone_bridge.py @@ -6,13 +6,32 @@ def wheatstone_solver( resistance_1: float, resistance_2: float, resistance_3: float ) -> float: """ - This function can calculate the unknown resistance in an wheatstone network, - given that the three other resistances in the network are known. - The formula to calculate the same is: - - --------------- - |Rx=(R2/R1)*R3| - --------------- + Calculate the unknown resistance (Rx) in a Wheatstone bridge circuit. + + A Wheatstone bridge is an electrical circuit used to precisely measure + an unknown resistance. This function calculates Rx when the three other + resistances in the bridge are known. + + Circuit Diagram: + + R1 R2 + +--/\/\/--+--/\/\/--+ + | | | + Vin Vg Vout + | | | + +--/\/\/--+--/\/\/--+ + R3 Rx + + This solver uses the balanced bridge formula: + Rx = (R2/R1) × R3 + + Args: + resistance_1 (R1): First known resistance + resistance_2 (R2): Second known resistance + resistance_3 (R3): Third known resistance + + Returns: + float: The calculated unknown resistance (Rx) Usage examples: >>> wheatstone_solver(resistance_1=2, resistance_2=4, resistance_3=5) From 33811fe69348c87250e1a4e06a2015fee10fba36 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 15 Feb 2026 12:02:52 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- electronics/wheatstone_bridge.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/electronics/wheatstone_bridge.py b/electronics/wheatstone_bridge.py index 544ea51b1fce..328d10fa20cf 100644 --- a/electronics/wheatstone_bridge.py +++ b/electronics/wheatstone_bridge.py @@ -8,12 +8,12 @@ def wheatstone_solver( """ Calculate the unknown resistance (Rx) in a Wheatstone bridge circuit. - A Wheatstone bridge is an electrical circuit used to precisely measure - an unknown resistance. This function calculates Rx when the three other + A Wheatstone bridge is an electrical circuit used to precisely measure + an unknown resistance. This function calculates Rx when the three other resistances in the bridge are known. Circuit Diagram: - + R1 R2 +--/\/\/--+--/\/\/--+ | | | @@ -21,15 +21,15 @@ def wheatstone_solver( | | | +--/\/\/--+--/\/\/--+ R3 Rx - + This solver uses the balanced bridge formula: Rx = (R2/R1) × R3 - + Args: resistance_1 (R1): First known resistance resistance_2 (R2): Second known resistance resistance_3 (R3): Third known resistance - + Returns: float: The calculated unknown resistance (Rx) From dd6747ab6e99bcdacd187c1d7b66c026ea96b37f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 16 Sep 2026 22:57:40 +0200 Subject: [PATCH 3/4] Fix docstring in wheatstone_solver function Corrected docstring formatting in wheatstone_solver function. --- electronics/wheatstone_bridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electronics/wheatstone_bridge.py b/electronics/wheatstone_bridge.py index d353046f9428..2efaf7c2c8be 100644 --- a/electronics/wheatstone_bridge.py +++ b/electronics/wheatstone_bridge.py @@ -5,7 +5,7 @@ def wheatstone_solver( resistance_1: float, resistance_2: float, resistance_3: float ) -> float: - """ + r""" Calculate the unknown resistance (Rx) in a Wheatstone bridge circuit. Wheatstone Bridge is an electrical circuit used to accurately measure From e8db38cc4ed5f5df041f000d48154e42db79237e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 16 Sep 2026 23:01:12 +0200 Subject: [PATCH 4/4] Add reference link for Wheatstone bridge Added a comment to reference the Wheatstone bridge Wikipedia page. --- electronics/wheatstone_bridge.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electronics/wheatstone_bridge.py b/electronics/wheatstone_bridge.py index 2efaf7c2c8be..42107be98004 100644 --- a/electronics/wheatstone_bridge.py +++ b/electronics/wheatstone_bridge.py @@ -1,4 +1,4 @@ -# https://en.wikipedia.org/wiki/Wheatstone_bridge +# ruff: noqa: RUF002 -- ambiguous-unicode-character-docstring from __future__ import annotations @@ -15,6 +15,7 @@ def wheatstone_solver( bridge are known. The bridge is said to be balanced when no current flows through the galvanometer connected between the midpoints of the two voltage dividers. + * # https://en.wikipedia.org/wiki/Wheatstone_bridge Circuit Diagram: