Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I’m stuck on getting Test 17 and 18 checks for “Build a Travel Weather Planner”. I’ve revised my code a few times and that resulted in more test failing. Unsure why 17 and 18 are failing, its probably just an oversight on my part.

Your code so far

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

if distance_mi == False:
    print('False')

if distance_mi <= 1 and is_raining == False:
    print('True')
elif 1 < distance_mi <= 6 and has_bike == True and is_raining == False:
    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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

What happens if distance_mi is 0?

Ah I see. I removed the nonsensical distance_mi = False check. Still had some errors going and messed around more with the code. I have a new issue that is more so for clarification purposes. Test 17 and 18 were failing, which are in relation to Line 10. How come when I added paratheses to my conditions on Line 12 (which again to my knowledge, is unrelated to the failing Tests), that I solved the lesson?

Because without the parentheses, your code could be interpreted like this:

(distance_mi > 6 and has_car) or (has_ride_share_app)

Ohhhhh okay that makes sense, awesome thank you!