Build a time weather planner

Tell us what’s happening: so , i write the code to match all the requirements and it still shows that they are not completed/matched. for example: i write so that when the distance is falsy it would print falsy but it still shows an x near that task. Pls help …

Your code so far

distance_mi = 1
is_raining = False
has_bike = True
has_car = False
has_ride_share_app =True
if not distance_mi == False:
    print('True')
else:
    print('False')
if distance_mi <= 1 and is_raining ==  False:
    print('True')
elif distance_mi <= 1 and is_raining == True:
    print('False')
elif distance_mi == 0:
    print('False')
else:
    print('False')
if (distance_mi > 1 and distance_mi <= 6) and (has_bike == True and is_raining == False):
    print('True')
else:
    print('False')
if distance_mi > 6 and has_car == True:
    print('True')
elif distance_mi > 6 and has_ride-share_app == True:
    print('True')
elif distance_mi > 6 and (has_car == False and has_drive_share_app == False):
        print('False')
else:
    print('False')

Lesson URL https://www.freecodecamp.org/learn/python-v9/lab-travel-weather-planner/build-a-travel-weather-planner

Hi @matanskis.l,

Your code should only print one thing – either True or False.

Currently, your code is printing this:

True
True
False
False

Happy coding

wait, so it should only print one word? So that means it should just be a long if… elif… else code, right?

Yes. You have the right idea.

Also, does it make sense to do any other processing if distance_mi is falsy?

it doesn’t. Ok, thanks for clearing it all up

hmmm, so i made one big chunk of code ( if…elif…else) but now every task except 22 and 24 is completed, but i dont undertsand why arent tey completed, it seems to me as if everything should be good and the error it shows says “Your code raised an error before any tests could run. Please fix it and try again.” is strange as in the terminal it doesnt show any errors. idk what to do. Pls help my code:

 distance_mi = 2

is_raining = False

has_bike = True

has_car = False

has_ride_share_app = True

if bool(distance_mi) == False:

    print('False')

elif distance_mi <= 1 and is_raining == False:

    print('True')

elif distance_mi <= 1 and is_raining == True:

    print('False')

elif (distance_mi >1 and distance_mi <= 6) and (has_bike == True and is_raining == False):

    print('True')

elif (distance_mi >1 and distance_mi <= 6) and (has_bike == False or is_raining == True):

    print('False')

elif distance_mi > 6 and (has_car == True or has_drive_share_app == True):

    print('True')

elif distance_mi > 6 and (has_car == False or has_drive_share_app == False):

    print('False')

elif distance_mi > 6 and (has_car == False or has_drive_share_app == False):

    print('False')

elif distance_mi > 6 and has_drive_share_app == True:

    print('True')

else:

    print('True')

what do i do @dhess ?

Check your browser’s console for this type of error.

huh? how to do that? Its the window near terminal?

because there it says “// running tests
22. Your code raised an error before any tests could run. Please fix it and try again.
24. Your code raised an error before any tests could run. Please fix it and try again.
// tests completed
// console output
True”

Try CTRL + SHIFT + I to open your browser’s console. Some use F12.

and from there go to console? im now on elements tab when i pressed ctrl shift i

is it here somehwere @dhess ?

Yes. Look for the name error:

image

omg, it worked, it was just a typo, drive instead of ride, thank you so much