Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I don’t understand how it isn’t a falsy value and why it isn’t working

Your code so far

distance_mi = 67
is_raining = True
has_bike = True
has_car = True
has_ride_share_app = True

if not distance_mi != 67:
    print('False')
elif distance_mi <= 1:
    if is_raining == False:
        print('True')
    else:
        print('False')    
elif distance_mi >= 1 and distance_mi <= 6:
    if has_bike == True and is_rain == False:
        print('True')
    else: 
        print('False')
elif distance_mi >= 6:
    if 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.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

Welcome to the forum @potatochips1!

Why are you hard coding here?

Also, you have an error in your code that is preventing the tests from running.

If you open your browser’s console, you’ll see this:

NameError: name 'is_rain' is not defined

Happy coding!

I still didn’t understand why it didn’t work for the falsy value, but i fixed the ‘is_rain’ mistake.

what is your logic to test for a falsy value? why are you using 67 there? how is 67 related to distance_mi being a falsy value?

if the ‘if’ the equation is false, it’s a falsy value

and how does 67 fits in there? remember you are checking for if not distance_mi != 67:

why do you have an equation that gives a different result for 66 and 67? is one falsy and the other truthy?

i still didn’t understand…

can you say why you wrote 67 in the equation if not distance_mi != 67:?

or, alternative question, what is a falsy value?

OHHH, i thought if i wrote distance_mi didn’t equal 67 it would be false

yes, that’s what it does, but is it useful to find if distance_mi is falsy?

i don’t think so? i’m really confused rn

so why don’t you delete the 67 from there and try to write the proper check for a falsy value?

i just deleted != 67 and it worked, but i didn’t understand why. Could you explain it to me?

do you understand that distance_mi != 67 is checking if distance_mi is different from 67? it will be False for 67 and True for anything else? (not distance_mi != 67 will be True for 67 and False for everything else)

so that means that this is not the way to identify falsy values

ohhhhhhh, but why writting nothing equals to a falsy value

are you sure you are writing nothing? what have you written now as condition?

i only wrote this : if not distance_mi:

and that is not nothing, you have the not operator, and you have distance_mi

do you know what not does?

i don’t does it make it false?

try it print(not True), and print(not False)

after you have tried with these, try with other values, print(not 1), print(not 67), print(not 0), print(not 'hello')

you will find that some values behave like True, those are the truthy values, and some values behave like False, those are the falsy values