Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I have correct output but when I run d tests the system still hints wrong answers for all the if elif else tests. Why is that?

Your code so far

distance_mi=9
is_raining=True
has_bike=True
has_car=True
has_ride_share_app=True
print(bool(distance_mi))

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

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

if distance_mi > 6 and (has_car or has_ride_share_app):
    print('True')
else:
    print('False')

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

For example, I set distance_mi to 0 to test the requirement " When distance_mi is a falsy value, the program should print False ."

In the terminal I see

False
False
False
False

that is a bit more than False

do you think you can make so that only one thing is printed?

now I got that you want only one-line output for any questions. But I still have trouble to fix it although I did get more check marks after modification. Here is what I have changed so far:

distance_mi=2

is_raining=True

has_bike=True

has_car=True

has_ride_share_app=True



if distance_mi <= 1 and is_raining==False:

    print('True')



if distance_mi > 1 and distance_mi <=6 and has_bike==True and not is_raining:

    print('True')



if distance_mi > 6 and (has_car==True or has_ride_share_app==True):

    print('True')

else:

    print('False')

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.

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 (').

the first failing test is

You should use at least one elif branch in your program

maybe start from that one

Only two issues here:

  1. You’re asked to use elif statements and not many if statements:
if condition:
elif condition:
elif condition:
else:
# AND NOT
if condition:
if condition:
if condition:
  1. You’re missing one condition

Check if distance_mi is a falsy value.