Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I am passing every test except 18 and 19 which, since both of them have to do with the condition between 1 mile and 6 miles, I am guessing has to do with the way I wrote the “between” statement:

I have no errors in the console so there is nothing wrong with the code as far as python in concerned, but 18 and 19 are not passing in the “Tests” section. It does appear to be printing the correct statement (True or False) in the console though.

Your code so far

distance_mi = 5
is_raining = False
has_bike = False
has_car = False
has_ride_share_app = False
if not distance_mi:
    print("False")
elif distance_mi <= 1 and not is_raining:
    print("True")
elif distance_mi > 1 and distance_mi <= 6 and has_bike and not is_raining:
    print("True")
elif distance_mi > 6 and has_car or has_ride_share_app:
    print("True")
else:
    print("False")





Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

This line will be evaluated as (distance_mi > 6 and has_car) or (has_ride_share). Is that what the related user story is saying?

Yes. That line isn’t the problem. It’s the line where distance_mi is greater than on and less than or equal to 6

1 Like

please do not assume, check and test

are you asked to print True everytime that has_ride_share is True?
this is what happens with the condition (distance_mi > 6 and has_car) or (has_ride_share)

I have run the test on the line of code that is distance_mi >6 and has_ or has_ride_share_app dozens of times and there is nothing wrong with that part of the code. Once again, the part of the code that is having issues is the one with the statement distance is between 1 and 6 miles.

have you tried with this?

distance_mi = 5
is_raining = False
has_bike = False
has_car = False
has_ride_share_app = True

it should say False, right? becautse it’s between 1 and 6 miles, it’s not raining but there is no bike

test it, it prints True

why?

because has_ride_share_app

so yes, you need to fix that part of your code

we are not trying to trick you, we are trying to point you to what you need to fix