Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

Hello, I’m struggling with placing elif statements so that 19 and 23 can both be met. I think I’m missing an elif statement or I’ve written has_bike incorrectly. I’ve tried different variables but they don’t fix 19 and 23. Any corrections or explanations would help a lot. Thanks in advance.

Your code so far


distance_mi = 0.5
is_raining = False
has_bike = False
has_car = False
has_ride_share_app = False

if distance_mi == 0:
    print(False)

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

elif distance_mi > 6:
    print(True)

elif has_bike == False:
    print(False)

elif distance_mi > 1 and distance_mi <= 6:
    print(True)

elif has_car == True or has_ride_share_app == True:
    print(True)

else:
    print(False)

Your browser information:

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

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

Welcome to the forum @I.O

What happens when is_raining is set to True?
Does changing the other variables make a difference?

Happy coding

You should use if, elif, and else statements to evaluate the distance categories in ascending order.

Are you evaluating distance_mi in ascending order?
Should we care if it’s raining when distance_mi is more than 6 miles?
Should we care if we have a bike if distance_mi is less than or equal 1 mile or distance_mi is more than 6 miles?

I’d suggest reviewing this theory lecture then reading through the user stories again to make sure you are implementing them correctly:
Booleans and Conditionals - What Are Truthy and Falsy Values, and How Do Boolean Operators and Short-Circuiting Work? | Learn | freeCodeCamp.org

Thanks that helped when I tried settings is_raining to True