Skip to content

Commit 6a08e1f

Browse files
fix: 🚨 resolve remaining ruff dictionary error
1 parent c3e5cf6 commit 6a08e1f

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎physics/boyles_law.py‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ def check_validity(values: dict[str, float]) -> None:
6969
if len(values) != 3:
7070
msg = f"Invalid input expected {3} items, got {len(values)}"
7171
raise ValueError(msg)
72-
else:
73-
for value in values:
74-
if value not in valid_variables:
75-
msg = f"Invalid input {value} is not a valid variable"
76-
raise ValueError(msg)
77-
if values[value] <= 0:
78-
msg = f"Invalid input {value} must be greater than 0"
79-
raise ValueError(msg)
80-
return
72+
for value, val in values.items():
73+
if value not in valid_variables:
74+
msg = f"Invalid input {value} is not a valid variable"
75+
raise ValueError(msg)
76+
if val <= 0:
77+
msg = f"Invalid input {value} must be greater than 0"
78+
raise ValueError(msg)
8179

8280

8381
def find_target_variable(values: dict[str, float]) -> str:

0 commit comments

Comments
 (0)