Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

Same error a lot of people are getting in Building a Weather Planner lab - probably the most common error:
“When distance_mi is a falsy value, the program should print False.”
Q- Isn’t distance_mi == 0 a falsy value? Why am i still receiving an error?

Your code so far

distance_mi = 5
is_raining = True
has_bike = True
has_car = True
has_ride_share_app = True
if distance_mi==0:
    print('False')
if distance_mi <= 1 and is_raining != True:
    print ('True') 
elif (distance_mi >= 1 and distance_mi<= 6) and has_bike:
    print ('True')
else:
    print ('False')
if 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; rv:148.0) Gecko/20100101 Firefox/148.0

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Welcome to the forum @whyyat

What about other falsy values ?

Happy coding

I don’t understand what you mean. “falsy” is obviously giving me big problems

distance_mi = 0 is a falsy value, is it not?

I modified the next iten of code to read:

if (distance_mi <= 1 and distance_mi !=0) and is_raining:

print ('False') 

I still get an error.

I am obviously stuck on something. I really don’t understand falsy obviously. Distance_mi = 0 is a falsy value.

test bu changing this to distance_mi=0, do you see printed exactly False, or more than that?

I don’t know and can’t tell. This falsy issue reminds me of taking first semester calculus in college. The TA’s were trying to teach epsilon and delta proofs half way thru the first semester. Nobody understood it, and it was unnecessary at that juncture, We were there to start learning computational tools and we were getting high level theory. This falsy issue is like that. It is not here that that subject should be presented. I hope this one lab does not impede my progress to the final goal of Python certification.

I am continuing on since I can’t fix the code to satisfy the AI

there isn’t an AI

when I update the code you posted with distance_mi=0 I see

False
False
False

the tests expect False only so they fail, so make sure you are not printing too many things

I tried but it still doesn’t work

Please create your own topic if you need help with this.