Build a Travel Weather Planner - Build a Travel Weather Planner

Tell us what’s happening:

I’m having a problem in the 4th step; I am not able to define a falsy value, thereby not being able to move forward with the code.

Your code so far

distance_mi=3
is_raining = False
has_bike = True
has_car = False
has_ride_share_app = False
if is_raining:
    print('how wil you be commuting?')
    if has_bike:
        print('commuting is possible!')
elif has_car or has_ride_share_app:
    print('commuting is not possible')
else:
    print('weather is clear!')

if distance_mi<=0:
    print(False)

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

elif distance_mi>1 and distance_mi<=6:
    if has_bike==True and is_raining==False:
        print(True)
    else:
        print(False)
else:
    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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Welcome to the forum @tanishaabatra !

Here is a resource that can help you identify falsy values:

Happy coding!

Tell us what’s happening:

facing problem in the 4th step i.e. ‘if distance_mi is a falsy value, print False’. please provide me with the correct code for the same.

Your code so far

distance_mi=3
is_raining = True
has_bike = True
has_car = True
has_ride_share_app = True
if is_raining:
    print('how wil you be commuting?')
    if has_bike:
        print('commuting is possible!')
elif has_car or has_ride_share_app:
    print('commuting is not possible')
else:
    print('weather is clear!')

if distance_mi==0:
    print(False)

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

elif distance_mi>1 and distance_mi<=6:
    if has_bike==True and is_raining==False:
        print(True)
    else:
        print(False)
else:
    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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Travel Weather Planner - Build a Travel Weather Planner

Hi @tanishaabatra ,

You are not asked to print anything other than True or False.

Here is a reference you can use to help you define falsy values:

Happy coding!

we will not, but you can check what your code does in that situation by updating this line:

to
distance_mi=0, so you can see what is printed in that case

I went ahead and combined your posts for you. In the future, just reply to the original thread to add further updates.

Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.