Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I have spent the better half of a day looking at this code. Where am I going wrong with the distance_mi falsy value?! Please if anyone has any info I would be grateful! So frustrating

Your code so far

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


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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Hi @ArguedPenguin31 ,

Please organize your code so it only prints one thing.

What happens if distance_mi is 0?

Happy coding!

1 Like

Hi @dhess, I have figured out 23 but I am still struggling with 15. Every if, not or == doesn’t work where am I going wrong? Is it my defs?

Please post your updated code, not a screenshot.


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

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

if not distance_mi:
    print(False)

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

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

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


If distance_mi is falsy, do you want your code to continue to process more if statements?

What change can you make so that your code only does further processing if distance_mi is truthy?

Man, thank you so much, I’ve been struggling with this program for half the day and yeah if I had known I was only answering one question using all those stuff, I could’ve done this way faster. That simple “prints one thing” helped me out so much. Again, thank you bruh!