I have correct output but when I run d tests the system still hints wrong answers for all the if elif else tests. Why is that?
Your code so far
distance_mi=9
is_raining=True
has_bike=True
has_car=True
has_ride_share_app=True
print(bool(distance_mi))
if distance_mi <= 1 and not is_raining:
print('True')
else:
print('False')
if distance_mi > 1 and distance_mi <=6:
print('True')
elif has_bike and not is_raining:
print('True')
else:
print('False')
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
now I got that you want only one-line output for any questions. But I still have trouble to fix it although I did get more check marks after modification. Here is what I have changed so far:
distance_mi=2
is_raining=True
has_bike=True
has_car=True
has_ride_share_app=True
if distance_mi <= 1 and is_raining==False:
print('True')
if distance_mi > 1 and distance_mi <=6 and has_bike==True and not is_raining:
print('True')
if distance_mi > 6 and (has_car==True or has_ride_share_app==True):
print('True')
else:
print('False')
I’ve edited your post to improve the readability of the code. 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.