Build a travel weather planner step 16 and op

Tell us what’s happening:

I’m having trouble with steps 16 and up in the Build a travel weather planner it’s saying “When the distance is 1 mile or less and it is not raining, the program should print True.”

Your code so far

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

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

what is your code printing in that situation?

you can read your code, or test by changing distance_mi = 0.9 and is_raining = False

Right now it’s printing
True 2 times
when i change it it becomes the same

that is an other issue, it must not print twice, only once, always

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

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

it now only sends one True but still nothing changes except if i put it to 0

test with distance_mi = 0.9 and is_raining = False, what does appear in the terminal? Can you show a screenshot?

also please format your code, when it is not formatted it looses indentation which is really important in Python

There are two ways you can format your code to make it easier to read and test:

  1. After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)

  1. Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.

To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor:

yea, sorry. when i changed that it now outputs False

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

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

When the distance is 1 mile or less and it is not raining, the program should print True.

and it should not be False, right? so please individuate which line of code is run for this situation and update it

Okay, so it was because i accidently had them in the wrong order but now i’m missing steps 19, 22,23 and 24.

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

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

look at this

what happens if it is raining and you have a car with a distance of 7 miles?

Oh, it just prints false? anyways i changed it now and it says my problem is " When the distance is 1 mile or less and it is raining, the program should print False."

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

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

before looking for logic errors you can see if you wrote what you meant

is this printing?

Nope, that is really not printing, i fixed it though so.