Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

The program appears to be returning the expected True or False returns as I change the arbitrary values in the input variables. The issue is that only the tests that match the input variables passes; while their inverse appears to always fail. Example: Test 15 passes when I put (0.5 miles and False) while 16 fails with the same values. If I change them to (0.5 and True), then 16 passes and 15 fails. Thank you for your help!

Your code so far

# Required vars
distance_mi: float = 0.5
is_raining: bool = False
has_bike: bool = True
has_car: bool = True
has_ride_share_app: bool = True

# Usecase 4: False
if not distance_mi:
        print(False)
# Usecase 5: True 
elif distance_mi <= 1 and (not is_raining):
        print(True)
# Usecase 6: True 
elif 1 < distance_mi <= 6 and (not is_raining and has_bike):
        print(True)
# Usecase 7: True
elif distance_mi > 6 and (has_car or has_ride_share_app):
        print(True)
# If any of the other conditionals are not met: False
else:
        print(False)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

I can confirm this challenge is definitely having some kind of issue with the code designed to read from the output.

My working theory is that value re-assignment isn’t happening. But thank you very much for reporting this issue.

Of course! I am stuck on the problem for now as no matter how many ways I try to adjust the conditionals, the issue continues to persist. Any suggestions on how to proceed? (Besides just moving on lol)

Welcome to the forum @luchodzf

Try it without type annotations.

Happy coding

2 Likes

Awesome job. I still wanna know why but that’s an issue for Python and the exec method. Their exec method may be using some kind of regex I imagine to find the values to find and replace; and the Python typings is not a part of the things it’s matching yet.

1 Like