Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

Failing on steps 16, 18, and 19, and 20, yet when I plug the appropriate variables in for the program to run, the console prints what the check wants it to. I’m a little confused, any ideas as to why this isn’t passing?

Thanks so much for anyone who can help!

Specifically, the tests are:

Failed: 16. When the distance is 1 mile or less and it is not raining, the program should print True.

Failed: 18. When the distance is between 1 mile (excluded) and 6 miles (included), and it is raining with no bike, the program should print False.

Failed: 19. When the distance is between 1 mile (excluded) and 6 miles (included), it is not raining but no bike is available, the program should print False.

Failed: 20. When the distance is between 1 mile (excluded) and 6 miles (included), a bike is available, and it is not raining, the program should print True.

Your code so far

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

if distance_mi:
    if has_car or has_ride_share_app:
        pass
    elif is_raining:
        go = False
    elif distance_mi <= 1:
        pass
    elif distance_mi > 1 and distance_mi <= 6 and has_bike:
        pass
    else:
        go = False
else:
    go = False
print(go)

Your browser information:

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

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Welcome to the forum @psilontech

When the distance is between 1 mile (excluded) and 6 miles (included), and it is raining with no bike, the program should print False.

If it is raining, your code logic will print False regardless of any other conditions.

Happy coding

The only circumstance in which the raining would not effect the outcome is if has_car or ride_share is true, which precedes that line though, right?

If has_car is true then it will not process to the is_raining elseif and none of the other methods of travel will result in a True if it’s raining.

Any other vehicle that is affected by rain?

The bike is affected by the rain, but takes place after that is_raining check. The rideshare check occurs before that check and is not affected.

I do very much appreciate you helping I’m just not quite wrapping my head around the point at which the logic breaks.

Oh I think I understand. The end result is the same but the lab is specifially checking to see if I’m checking the 1-6 mile area for bike AND rain and not if the answer is correct, right?

Thank you very much for your assistance, kind sir!