Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I don’t know if it’s taking too long to run or if there’s an error somewhere but I believe I did this task the right way.

Your code so far

# A Code to Check if a Person Can Travel

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

# ... Given the Conditions:

if not isinstance (distance_mi, int): # The distance value has to be integer (and non-zero)!
    print (False)

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

elif distance <= 6:
    # If the distance l is between 1-6 miles
    if not is_raining or has_bike:
        print (True)
    else:
        print (False)

else:
    # If the distance is more than 6 miles:
    if has_car or has_ride_share_app:
        print (True)
    else:
        print (False)


Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Check your logic here.

And aren’t you seeing an error in the console? NameError: name 'distance' is not defined

Zero is an integer, but is it truthy?

Thank you. I checked the instructions one more time, re-wrote the code step by step, and passed the task!

1 Like

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