Hey I’m stuck. the only “x” I’m getting is for term no. 18.
18. When the distance is between 1 mile (excluded) and 6 miles (included), and it is raining with no bike, the program should print False. I’m suck because when I input those terms into the code, the program does print “False”. it’s the only one left but every time I change lines to mimic these terms specifically two other terms are not met.
Your code so far
distance_mi = 4
is_raining = False
has_bike = True
has_car = False
has_ride_share_app = False
if not distance_mi:
print('False')
elif distance_mi <=1 and is_raining == False:
print('True')
elif distance_mi <= 1 and is_raining == False and has_bike == True:
print("True")
elif distance_mi >1 and distance_mi <=6 and is_raining == False and has_bike == True:
print('True')
elif distance_mi >1 and distance_mi <=6 and has_bike == False and is_raining == False:
print('False')
elif distance_mi >6 and has_car == True or has_ride_share_app == True:
print('True')
else:
print('False')
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
What happens if distance_mi is not greater than 6 but has_ride_share_app is true? The way you’ve written it, that will return true. In other words, that statement will always return true if has_ride_share_app is true.
should the part about the ride-share app be independent from the distance? or that also depend from the distance? consider how the condition is separated here, one part has the distance condition, the other doesn’t if (distance_mi >6 and has_car == True) or (has_ride_share_app == True)