Tell us what’s happening:
I hope this is appropriate to ask here? I just did the travel weather planner lab, and after a bit of trial and error, I managed to finish it! Now I just want to know if there’s a way to clean up the code a bit or make it more concise/readable, I feel like especially with the final 3 steps I coulda used an “or” statement but when I tried I couldn’t get it to work.
Your code so far
distance_mi=.9
is_raining=True
has_bike=True
has_car=False
has_ride_share_app=False
if distance_mi<=0:
print(False)
else:
if distance_mi<=1:
if is_raining is True:
print(False)
else:
print(True)
elif distance_mi>1 and distance_mi<=6:
if has_bike is True and is_raining is False:
print(True)
else:
print(False)
else:
if has_ride_share_app is True:
print(True)
elif has_car is True:
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/145.0.0.0 Safari/537.36 OPR/129.0.0.0
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner