Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

21 and 23 step is not working I have tried many times but not able to know the problem

Your code so far

distance_mi = 3
is_raining = False
has_bike = True
has_car = False
has_ride_share_app = False
if distance_mi == False:
    print('False')
elif distance_mi <=1:
    if is_raining == False:
       print('True')
    else:
        print('False')
elif distance_mi >1 or distance_mi <=6:
    if has_bike:
        print('True')
    else: 
        print('False')
elif distance_mi > 6:
    if (has_car or has_ride_share_app) :
        print('True')
    

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

try to put these values to test

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

no it is not working now alsp

do you remember that with or only one of the two needs to be True?

meaning, this one is True for distance_mi=7

Yes I know it but function is not working for greater value of 6 of distance for having car it is giving true but for having rude it is not working

continuining my last post, distance_mi=7 makes distance_mi > 1 be True, so that means that the whole condition of elif distance_mi >1 or distance_mi <=6: is True, meaning the code inside this is executed, not the one for distance_mi > 6

When distance_mi = 7, this is evaluated like this;
if (distance_mi > 1) ← true
OR
(distance_mi <= 6) ← false, but because the first expression is true and you used the OR operator, the code will never get to this expression.

What operator can you use to make sure both expressions are evaluated to be true?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.