The problem description for PSET 5 Refueling has the following description:
The check50 validation fails at step 2 :( correct fuel.py passes all test_fuel checks If user attempts to add a test for the requirement the nearest int between 0 and 100, inclusive.:
def convert(input: str) -> int:
# Will raise ValueError if int() conversion fails
# Will raise ValueError if too many values to unpack
dividend, divisor = (int(value) for value in input.split("/"))
if dividend > divisor:
raise ValueError("Dividend can not be larger than divisor.")
result = round((dividend / divisor) * 100)
if result not in range(0, 101):
raise ValueError("Result must be an int between 0 and 100, inclusive.")
return result
Preconditions
Have a
test_fuel.py
, which passes the check50 validation:Steps to reproduce:
test_fuel.py
:check50 cs50/problems/2022/python/tests/fuel
Expected result
Actual result
The check50 validation fails at step 2
:( correct fuel.py passes all test_fuel checks
If user attempts to add a test for the requirementthe nearest int between 0 and 100, inclusive.
:When the test is enabled:
When skipping the test: