on the second distance check on the travel weather planner my code fails. I’ve completely deleted and started over from scratch - with the same results. The tests fail at step 19 on. There is something ambiguous going on that I’m not able to pin down. Any help would be greatly appreciated.
Your code so far
distance_mi = 2
is_raining = True
has_bike = True
has_car = True
has_ride_share_app = True
if distance_mi > 0:
if distance_mi <= 1 and is_raining == False:
print('True')
else:
print('False')
elif distance_mi > 1 and distance_mi <= 6:
if has_bike == True and is_raining == False:
print('True')
else:
print('False')
else:
if 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; rv:147.0) Gecko/20100101 Firefox/147.0
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
Just redid the code with a second elif and an ending else to catch if the distance is falsy (not greater than 0), getting the same error messages on the first elif statement for the check between 1 and 6.
oh, so i think I’m getting it. If I’m understanding you correctly, the code does not drop down and execute every elif, rather when there is either a success or fail it prints the one message, and then drops out of the entire if structure, and ends the program?
It’s been a hot minute since I’ve coded anything and I’m a little embarrassed at missing glaring logic fails.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.