File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818from math import cos , radians as deg_to_rad
1919
2020
21- def check_args (
22- magnetic_field : float ,
23- area : float ,
24- angle : float
25- ) -> None :
21+ def check_args (magnetic_field : float , area : float , angle : float ) -> None :
2622 """
2723 Check that the arguments are valid
2824 """
@@ -36,11 +32,11 @@ def check_args(
3632
3733 if not isinstance (angle , (int , float )):
3834 raise TypeError ("Invalid angle. Should be an integer or float." )
39-
35+
4036 # Ensure valid angle
4137 if angle < 0 or angle > 180 :
4238 raise ValueError ("Invalid angle. Range is 0-180 degrees." )
43-
39+
4440 # Ensure valid magnetic field
4541 if magnetic_field < 0 :
4642 raise ValueError ("Invalid magnetic field. Should be a positive number." )
@@ -50,11 +46,7 @@ def check_args(
5046 raise ValueError ("Invalid area. Should be a positive number." )
5147
5248
53- def magnetic_flux (
54- magnetic_field : float ,
55- area : float ,
56- angle : float
57- ) -> float :
49+ def magnetic_flux (magnetic_field : float , area : float , angle : float ) -> float :
5850 """
5951 >>> magnetic_flux(50.0, 2, 0.0)
6052 250.0
You can’t perform that action at this time.
0 commit comments