From ce63ace742d45a2366d7118136eb5dd2af3cb2a3 Mon Sep 17 00:00:00 2001 From: Vini Antunes <57882903+ViniViniAntunes@users.noreply.github.com> Date: Sat, 4 Oct 2025 19:11:05 -0300 Subject: [PATCH 1/2] Update magnetic_flux.py Fix the test string mode --- physics/magnetic_flux.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/physics/magnetic_flux.py b/physics/magnetic_flux.py index b255d848d253..83224e93318b 100644 --- a/physics/magnetic_flux.py +++ b/physics/magnetic_flux.py @@ -57,11 +57,9 @@ def magnetic_flux( ) -> float: """ >>> magnetic_flux(50.0, 2, 0.0) - 250.0 - >>> magnetic_flux(1.5, 3.0, 60.0) - 2.25 - >>> magnetic_flux(1.5, 3.0, -60.0) - 2.25 + 100.0 + >>> magnetic_flux(50, 2, 60.0) + 50.0 >>> magnetic_flux(0.5, 4.0, 90.0) 0.0 >>> magnetic_flux(1, 2.0, 180.0) From 68edbdbc4a88593be41da74f2c0e7cb842e0968b Mon Sep 17 00:00:00 2001 From: Vini Antunes <57882903+ViniViniAntunes@users.noreply.github.com> Date: Sat, 4 Oct 2025 22:45:44 -0300 Subject: [PATCH 2/2] Update magnetic_flux.py Fitting to ruff.yml --- physics/magnetic_flux.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/physics/magnetic_flux.py b/physics/magnetic_flux.py index 83224e93318b..87f716e4e641 100644 --- a/physics/magnetic_flux.py +++ b/physics/magnetic_flux.py @@ -1,8 +1,9 @@ """ -Magnetic flux (Φ) is a scalar quantity that measures the number of magnetic field lines (B) -that pass through a closed area (A). Furthermore, the magnetic flux depends on the angle -formed between the magnetic field and the normal line (N) in area A. Check out the formula -used to calculate this flux: +________________________________________________________________________________________ +Magnetic flux (Φ) is a scalar quantity that measures the number of magnetic field +lines (B) that pass through a closed area (A). Furthermore, the magnetic flux depends +on the angle formed between the magnetic field and the normal line (N) in area A. +Check out the formula used to calculate this flux: ------------ | Φ = B.A.cos(θ) | ------------ @@ -15,8 +16,7 @@ (Description adapted from https://en.wikipedia.org/wiki/Ideal_gas_law ) """ -from math import cos, radians as deg_to_rad - +from math import cos, radians def check_args( magnetic_field: float, @@ -75,8 +75,8 @@ def magnetic_flux( ... ValueError: Invalid area. Should be a positive number. """ check_args(magnetic_field, area, angle) - radians = deg_to_rad(angle) - return magnetic_field * area * cos(radians) + rad = radians(angle) + return magnetic_field * area * cos(rad) if __name__ == "__main__":