I don't know what is wrong with my code .May someone please help me i have tried checking were i went wrong,

distance_mi = 10

is_raining = True

has_bike = False

has_car = True

has_ride_share_app = False



if is_raining and has_bike:

    print('communication is not possible')

elif distance_mi < 5 or has_car:

    print('communication is possible')

else:

    print('communication is possible')

if not distance_mi:

    print('False')

    if distance_mi <= 1:

        if distance_mi > 1 and distance <= 6:

            print('False')

            if distance_mi > 6:

                print('True')

            elif has_ride_share_app:

                print('True')

            elif has_car:

                print('True')

            else:

                print('False')

        elif is_raining:

            print('False')

        elif has_bike:

            print('False')

        else:

            print('True')

    elif is_raining == False:

        print('True')

    else:

        print('False')

else:

    print('True')

Welcome to the forum @sebolaanengtshepang!

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read and test.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').


In the future, if you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Happy coding!

Please organize your code so that it prints only one thing, either True or False. Also, please note that the logic should be based on the value of distance_mi.

so if i may ask is my code correct ,because i can’t seem to fullfil what is needed at code 15

distance_mi = 10

is_raining = True

has_bike = False

has_car = True

has_ride_share_app = False

if is_raining and has_bike:

print('communication is not possible')

elif distance_mi < 5 or has_car:

print('communication is possible')

else:

print('communication is possible')

if not distance_mi :

print('False')

if distance_mi <= 1:

if distance_mi > 1 and distance <= 6:

    print('False')

    if distance_mi > 6:

        print('True')

    elif has_ride_share_app:

        print('True')

    elif has_car:

        print('True')

    else:

        print('False')

elif is_raining:

    print('False')

elif has_bike:

    print('False')

else:

    print('True')

elif is_raining == False:

print('True')

else:

print('False')

i have tried updating it and doing as you say nothing is working out

Please format your updated code as asked in a previous post and include a link to this challenge.

Hi there. So I’m not sure yet what the code is supposed to do, but from what you shared, one logical issue I noticed was that in your nested "if"s, you have a condition where you test:

if distance_mi <= 1:
    if distance_mi > 1 and distance_mi <= 6:... 

You tested a variable to be less than or equal to ‘1’ and then nested another ‘if’ to test for the same variable to be greater than ‘1’. There could be other issues, but this one would invalidate the rest of the logic, and would require rewriting the code.

I have tried updating it but the issue is not there,please explaing code 12 and 13 i want to have clear understanding of how you interprete it .

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

if is_raining and has_bike:
    print('communication is not possible')
elif distance_mi < 5 or has_car:
    print('communication is possible')
else:
    print('communication is possible')

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

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



Build a Travel Weather Planner - Build a Travel Weather Planner

Test - 15

what is said is that 'Test - 15 …When distance_mi is a falsy value ,the program should print False .these is what i did but i am still stuck here ,please correct me were i am wrong or guide me .

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

Shouldn’t checking for a falsy value be the first thing you do since processing should stop right there and return False?

if i may ask what you are saying is that the first thing i should do before coding anything should be checking the falsy value?

These is what i understand from what your are asking.

why are you printing these?

remember, the user stories ask you to print True or False only, not other things. Make sure there is only one thing printed in the terminal at a time

thank you i was able to fix my mistakes , modified my code and it went well.

you have a indentation error on else

thanks bruv i was able to correct it