Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

for more than a week i still can’t by pass this code/test 15. When the distance is 1 mile or less and it is not raining, the program should print True.

please help me

Your code so far

distance_mi = 1
is_raining = True
has_bike = True
has_car = False
has_ride_share_app = True

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

if distance_mi <= 6 and (is_raining and has_bike == False):
    print(False)
elif distance_mi <= 6 and (is_raining == False and  has_bike == False):
    print(False)
elif distance_mi <= 6 and (has_bike and is_raining == False):
    print(True)
elif distance_mi > 6 and has_ride_share_app:
    print(True)
elif distance_mi > 6 and has_car == True:
    print(True)
elif distance_mi > 6 and (has_car or has_ride_share_app == False):
    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

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

With your current settings, does your code ever get to the elif? Use print() statements to test your code.

i have try and done everything but still not getting it right,for more than a week now. i have even try to ask ChatGPT for help still to no avail.

This is all about reasoning and logic. If your code never reaches the elif, what can you change to make sure it does? We do not hand out solutions here, but we will guide you so you can figure it out yourself.

please do guide me, from my code above what adjustment do i need to do ? bcoz i have done so many adjustment with my reasoning but to no avail

I am guiding you by telling you where to look for an issue and teaching you to use print() statements in your code so you can see what your conditions and variables are or even to see if the code reaches the print() statement.

Please don’t use ChatGPT; it’s against forum rules to use AI.

okay, i will refrain from using AI, MY BAD. Let me try again and get back to you

Sir i have checked and tried everything still can’t bypass the test 15. and i think the problem is from my first If statement

What happens when you test your program with that input?

Did you check that the User Story is implemented correctly?

Please show what you have done to test with print statements.

Tell us what’s happening:

this is my code so far ,tried everything and user story is followed still

Your code so far

distance_mi = 1
is_raining = True
has_bike = True
has_car = False
has_ride_share_app = True

if distance_mi <= 1 and is_raining == False: 
    print(True)
   
elif distance_mi <= 1 and is_raining:
    print(False)
    
   
if distance_mi <= 6 and (is_raining and has_bike == False):
    print(False)
elif distance_mi <= 6 and (is_raining == False and  has_bike == False):
    print(False)
elif distance_mi <= 6 and (has_bike and is_raining == False):
    print(True)
elif distance_mi > 6 and has_ride_share_app:
    print(True)
elif distance_mi > 6 and has_car == True:
    print(True)
elif distance_mi > 6 and (has_car or has_ride_share_app == False):
    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

Please don’t create a duplicate topic for the same challenge/step. I have moved your post into this existing topic.

What happens if you change distance_mi to 2? Does anything print?

  1. If the distance is greater than 1 mile and less than or equal to 6 miles:
  • You should print True only if the person has a bike and it is not raining.
  • Otherwise, you should print False.

Does your code meet this requirement?