Skip to content
Closed
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/linear_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def solve_linear_equation(a: float, b: float) -> str:
Returns:
str: The solution to the equation, or a string indicating that there are no solutions or infinite solutions.
"""
if math.isclose(a, 0):
if math.isclose(b, 0):
if math.isclose(a, 0, abs_tol=1e-09):
if math.isclose(b, 0, abs_tol=1e-09):
return "Infinite solutions"
else:
return "No solution"
Expand All @@ -32,4 +32,4 @@ def solve_linear_equation(a: float, b: float) -> str:
a = 2.0
b = 4.0
solution = solve_linear_equation(a, b)
print("Solution:", solution)
print("Solution:", solution)