Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I have written the following code and it passes all tests except for test 16, even though it prints ‘True’ in the console. What am I missing?

Your code so far

distance_mi=0.7
is_raining=False
has_bike=True
has_car=False
has_ride_share_app=False
if distance_mi == bool(distance_mi):
    print('False')
elif distance_mi <=1 and not is_raining:
    print('True')
elif (distance_mi >1 and distance_mi <=6) and (has_bike == True and not is_raining):
    print('True')
elif distance_mi >6 and (has_car == True or has_ride_share_app == True):
    print('True')
else:
    print('False')



Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.3.1 Safari/605.1.15 Ddg/26.3.1

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

I am trying with

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

and your code prints False, it’s still in the “one mile or less”, so it should print True, shouldn’t it?

you are correct, I am at a loss though as the ‘elif’ clearly states the condition as ‘<=1’

I solved it by changing the first condition from:

if distance_mi == bool(distance_mi):
print(‘False’)

to

if not distance_mi:

print('False')

Not 100% sure yet why but now it works!