im stumped on steps 17-19. tbh this whole boolean conditionals is really difficult to understand as far as how the pieces link together. i get the HOW but not the WHY. or i guess somewhere in between that LOL
Your code so far
distance_mi=4
is_raining=True
has_bike=False
has_car=True
has_ride_share_app=True
if distance_mi >= 1 and is_raining == 'False':
print(bool(distance_mi or is_raining))
elif distance_mi >= 1 and distance_mi <= 6 and is_raining == 'True':
print(bool(distance_mi or is_raining))
if distance_mi >6 and has_ride_share_app != 'True' and has_car!='True':
print(bool(distance_mi or is_raining))
if distance_mi >= 1 and is_raining != 'False':
print(bool(distance_mi or is_raining))
else:
print(bool(distance_mi))
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
Won’t this always print True if distance_mi is truthy? Try adding some extra prints inside the if code blocks to see where your code is going with different values.
i rewrote my code because it was a mess and i think i understand a bit better. my original post was messy. also the wonders of code you fix something and break something else
distance_mi=0.5
is_raining=False
has_bike=True
has_car=True
has_ride_share_app=True
if distance_mi == bool(distance_mi):
print("in boolean")
print('False')
elif distance_mi <= 1 and is_raining == 'False':
print("in <=1 no rain")
print('True')
elif distance_mi <= 1 and is_raining == 'True':
print("in <= 1 rain")
print('False')
else:
print("in else")
if distance_mi>6 and has_car =='True':
print("in >6 and car")
print:('True')
else:
print("in >6 else")
See how I’ve added print statements throughout your code to debug? Try testing with different values to see if your code is going where you think is should. And make sure you are meeting the requirements for all of the user stories.
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!