Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

Hi!
Hoping someone can help where I got off track because I am stuck on task 21. What is interesting is task 22 is marked as complete, despite not mentioning has_car anywhere in the code outside of assigning it value , making me question is there is a bug somewhere.
Hopefully someone can help me progress! Thank you

Your code so far

distance_mi=7
is_raining=True
has_bike=True
has_car=True
has_ride_share_app=True

if not distance_mi:
    print(False)

elif distance_mi<=1:
    if not is_raining:
        print(True)
    else:
        print(False)

elif distance_mi>1<=6:
    if is_raining and not has_bike:
        print(False)
    if not is_raining and not has_bike:
        print(False)
    if not is_raining and has_bike:
        print(True)

elif distance_mi>6:
    if has_ride_share_app:
        print(True)
    

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

GitHub Link: https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/lab-travel-weather-planner/694acade1d4afdbce71e5840.md

Hey @PossumKweenie

You’ve raised a valid point, despite not mentioning has_car anywhere in the code, other than assigning value, it is being passed. Well the reason is the below line

This is a chained comparison so if we break it, it would be

(distance_mi > 1) and (1 <= 6)

If you look at the second part, you would realize that it is always true so code only goes through this if block if distance_mi > 1.

And test no. 22, assigns False to is_raining and True to has_bike and since your code is only going through elif distance_mi>1<=6:, it passes the test.