Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

15
Changed distance to 0 and it stayed true. Not sure what I’m doing wrong. Read the geeksforgeeks link from another forum post and still confused. Does else: print(“False”) not qualify for this?

17, 18, 19
I’ve looked over my code and read the forum posts and still can’t figure out what’s wrong.

23

I’ve tried “and” and “or” between has_car has has_app.

I hope this is enough details. I’ve been working on this a few days and struggling.

Your code so far

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


if distance_mi:
    print("True")
elif distance_mi <= 1 and not is_raining:
    print("True")
elif distance_mi <= 1 and is_raining:
    print("False")
elif (1 > distance_mi >= 6) and (is_raining and not has_bike):
    print("False")
elif (1 > distance_mi >= 6) and (not is_raining and not has_bike):
    print("False")
elif (1 > distance_mi >= 6) and (has_bike and not is_raining):
    print("True")
elif distance_mi > 6 and has_ride_share_app:
    print("True")
elif distance_mi > 6 and has_car:
    print("True")
elif distance > 6 and not has_car and not has_ride_share_app:
    print("False")
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/152.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-travel-weather-planner/694acade1d4afdbce71e5840.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @abgloster,

Wouldn’t you want to check if distance_mi is falsy so you can stop processing anything else?

Since you have written else: print("False"), wouldn’t it follow then that all of the above conditions should
only need to be checked for what is True (after checking to make sure distance_mi is not falsy of course)?

Happy coding

I really appreciate the way you word your responses. This is twice it’s helped me think of the problem from another angle. Which helped me notice some other problems as well. Then it got me to the point where I could use a couple hints. Now it’s solved! Thank you so much!