Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

Instructions 15 - 23 is incorrect and I am unsure on how to correct them.

Your code so far

distance_mi = 0
int(distance_mi)
is_raining = False
has_bike = True
has_car = True
has_ride_share_app = True


 

if distance_mi <= 1 and (is_raining == False):
 print(True)

else:
 print(False)

if distance_mi > 1 or distance_mi <= 6:
 print(True)

elif has_bike == True and is_raining == False:
 print(True)
  
else:
 print(False)

if 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Keep in mind I’m still very much a beginner myself so grain of salt here BUT:

I’m thinking the or statement here is a problem and will trigger for anything larger than one OR less than or equal to six, so it will trigger on 7, 8, 9, etc which we don’t want.

Changing that or to an and and rolling the is_raining variable into the same line with a second and might yield better results!

Here I think it’s only ever going to get to the elif when the distance is less than six, might try using an additional ‘and’ statement and parenthesis setup like (variable1 or variable2).

Have you figured out how to get it to print False if it’s a falsey value?

So if I want to check if something is falsy (and I’m sure there’s a much better way of doing it) I’ll do something like:

if variable:
    print(True)
else:
    print(False)

The if statement will only run if the variable is truthy.

or if you’re working with a variable that’s going to hold a boolian, you can set its default state to True when establishing it

bool_check = True
if variable:
    pass #this does nothing, just keeps it as it is
else:
    bool_check = False
print(bool_check)

How useful this will be outside of very limited circumstance is up for debate from someone with more experience though.

THANK YOU! I was trying a different way and would get the same result; however, it was not how they wanted it to be written.

removed by moderator

Congratulations on solving the challenge! You should be proud of your achievement…we are! But we are removing your working solution, so it is not available to others who have not yet done the work to get there. Again, congrats!