Hello Guys,
i´m not getting the expected result at line 11 and i just cant figure out what i´m not seeing. I tried to change the values and in my opinion it works as expected but it wont approve. Can someone give me a hint to what i should put my focus on.
Thanks for you help
Your code so far
distance_mi = 5
is_raining = False
has_bike = True
has_car = False
has_ride_share_app= True
if distance_mi == False:
print(False)
elif distance_mi <= 1 and not is_raining:
print(True)
elif distance_mi > 1 and distance_mi <= 6 and is_raining == False and has_bike == True:
print(True)
elif distance_mi > 6 and has_ride_share_app or has_car:
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/150.0.0.0 Safari/537.36
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
Please take a look at this reference to learn more about how to handle falsy values:
Also, note that, “When multiple logical operators are used in an if statement, conditions joined with and are evaluated before conditions joined with or. Parentheses () are used in Python to group conditions and control the order in which they are evaluated.”
Thank you very much, i got it now. Thought it was inherent to test for falsey that way.
Also the parentheses makes sense now
I got one more question that i couldnt find the answer for if you may.
is there a way to negate a condition that uses the return of a function? like where to use not or !.
Sorry couldnt find an answerto that.
You would use not to negate a Boolean, so saying not raining would work as opposed to raining == False. You would use != to check for equality (some value is not equal to another value).