Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I need help with checking my code.
I’m having trouble with step 21, where using a ride share app over 6 miles must read true. I’ve managed to get it with car, did the same code, everything seems to work fine, but I’m not passing. Am I missing something?

Your code so far

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

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

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

this will check has_bike and is_raining indipendently from the distance, so if you have

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

this should print True because distance is higher than 6 miles and you have a ride share app, but actually, it prints False, because not has_bike is True

1 Like

Thank you so much!
I put in the distance conditions in that line and it made everything work perfectly. Thanks again!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.