Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

So after trying to get the whole program to work at once, I decided to start over doing one step at a time and on step 5 (on the “If the distance is less than or equal to 1 mile:”) is where im stuck because it skips tests 15 and 16 but marks tests 17 and 18 as done where it says “if the distance is between 1 and 6 miles” but I didnt put 6 miles anywhere. Can someone please explain?

Your code so far

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


if not isinstance (distance_mi, int):
    print('False')

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


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

At this point your code gives such answers, that both 17 and 18 tests are passing. They are not checking what happens outside of the specified boundary, so it’s not a concern for them that result for distances above of 6 will be the same - that might be checked by different tests.

consider how many distances less than 1 mile are integers

what happens if I need to travel 0.5 mi?

Tell us what’s happening:

After some fixes, I got step 5 to work. But on step 6, I get a syntax error when I type <=6, so I didn’t type it in and continued to step 7. It marks all the other tests as done except for test 19. Also, in the terminal, the word ‘False’ is shown. I’m not sure if anything needs to be typed in the terminal. I would appreciate it if someone could explain to me how my code works.

Your code so far

distance_mi = 7
is_raining = False
has_bike = False
has_car = False
has_ride_share_app = False



if distance_mi == False:
    print('False')

#miles less than or equal to 1
if distance_mi <= 1 and is_raining == False:
        print('True')
elif distance_mi <= 1 and is_raining:
        print('False')

#miles between 1 and 6 miles
elif distance_mi > 1 and has_bike == False and is_raining == True:
        print('False')

#miles greater than 6 
elif distance_mi > 6 and has_ride_share_app:
        print('True')
elif distance_mi > 6 and has_car:
        print('True')
elif distance_mi > 6 and has_car == False and has_ride_share_app == False:
        print('False')

else:
        print('False')

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Welcome to the forum @xdanielaaron45

I went ahead and combined your posts for you. In the future, just reply to the original thread to add further updates.

1 Like
  1. When the distance is between 1 mile (excluded) and 6 miles (included), a bike is available, and it is not raining, the program should print True.

Try setting has_bike to True, find out where the output is located.

The output is coming from

if distance_mi <= 1 and is_raining == False:

    print('True')

it changes to True if i set the distance_mi to 1

The conditional logic needs to factor in having a bike.

After more than a week, my code finally passed! Thanks for the tips, everyone!

1 Like