Tell us what’s happening:
’ When distance_mi is a falsy value, the program should print False ’
i couldnt fix this problem
Your code so far
distance_mi = 0
is_raining = True
has_bike = True
has_car = True
has_ride_share_app = True
if distance_mi == False:
print ("False")
distance_mi = 1
if distance_mi <= 1 and is_raining == False:
print ('True')
elif is_raining == True:
print('False')
distance_mi = 2
is_raining = False
has_bike = False
if distance_mi >= 1 and distance_mi <= 6 and (is_raining == True and has_bike == False):
print('False')
elif is_raining == False:
print('False')
else :
print('True')
distance_mi = 8
has_car = True
has_ride_share_app = False
if distance_mi > 6 and (has_ride_share_app == True) :
print ('True')
elif has_car == 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/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
dhess
September 4, 2026, 1:55pm
2
Welcome to the forum @mxdbenida
mxdbenida:
distance_mi = 2
When you want to test another value for distance_mi, please change the value in your first assignment rather than reassigning the value inside the code.
Also, your code should be organized so it only prints thing – either True or False.
You can take a look at this reference for more information about how to recognize and handle falsy values:
Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and...
Hope that helps.
thank u for ur welcoming
i couldn’t understand what do u mean by changing the first assignment rather than keep reassigning it
is it mistake
and is my code is not correct?
dhess
September 4, 2026, 3:03pm
4
These are your variable declarations and assignments you use to test with:
When you want to test another value for these variables, make the change there.
Constantly reassigning these variable values within your code block makes your code inflexible…a lot like hard coding expected values.
Does that help?