Travel Weather Planner 的测试和提示不完整且不准确
作者: majestic-owl448创建于 2026年9月23日更新于 2026年9月30日
标签help wantedscope: curriculumpython v9 cert
- Rain-dependent behavior is not distinguished by the tests
run_case(
{
"distance_mi": 2,
"is_raining": True,
"has_bike": False,
"has_car": True,
"has_ride_share_app": True
},
"False"
)run_case(
{
"distance_mi": 2,
"is_raining": False,
"has_bike": True,
"has_car": False,
"has_ride_share_app": False
},
"True"
)run_case(
{
"distance_mi": 12,
"is_raining": False,
"has_bike": False,
"has_car": False,
"has_ride_share_app": True
},
"True"
)run_case(
{
"distance_mi": 12,
"is_raining": False,
"has_bike": True,
"has_car": True,
"has_ride_share_app": False
},
"True"
)Replacing print(has_bike and not is_raining) with print(has_bike) passes all nine behavioral tests, although a rainy two-mile trip with a bike must print False. Independently, replacing the final output with print((has_car or has_ride_share_app) and not is_raining) also passes all nine tests, although rain must not prevent a long trip when a car or ride-share app is available.
内容来源: freeCodeCamp/freeCodeCamp