please i need pointers. i can’t get past here even though on the terminal i got ‘False’ but still not able to pass also i reinterpreted the question and reconstructed the code several times all did not help.
Your code so far
distance_mi = 1
is_raining = True
has_bike = False
has_car = True
has_ride_share_app = False
if not distance_mi:
print(False)
elif distance_mi <= 1 and not is_raining:
print(True)
if distance_mi > 1 and has_bike:
print(True)
if distance_mi <= 6 and has_bike and not is_raining:
print(True)
elif distance_mi > 6 and has_car or has_ride_share_app:
print(True)
else:
print(False)
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/154.0.0.0 Safari/537.36
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
it still tell me the same thing and that line it is referring to i can’t find any bug in there because i referred from the question or can i modify it to ignore what the question asked?
distance_mi = 0
is_raining = False
has_bike = False
has_car = True
has_ride_share_app = False
if not distance_mi:
print(False)
elif distance_mi <= 1 and not is_raining:
print(True)
if distance_mi > 1 and has_bike:
print(True)
if distance_mi <= 6 and has_bike and not is_raining:
print(True)
elif distance_mi > 6 and has_car or has_ride_share_app:
print(True)
else:
print(False)
else:
print(False)
that first line will always print then something from inside the if-elif-else chain will also always print, that makes two things printed, you need to always print only one thing
thanks for you reply but now i made changes and it seems to be always printing one thing but still can’t past, it is still telling me the same thing am even more confused now
distance_mi = 8
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 not is_raining and distance_mi > 1 and has_bike:
print(True)
if distance_mi <= 6 and has_bike and not is_raining:
print(True)
elif distance_mi > 6 and has_car or has_ride_share_app:
print(True)
else:
print(False)
else:
print(False)
There are two ways you can format your code to make it easier to read and test:
After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)
Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.
To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor:
now i figure my problem out which was because i did not arrange it in ascending order and also that else condition in the middle was causing me a lot of harm. now i have passed. thanks!