I can only get this to print false. Completely new to this and can’t see why it’s doing this. I feel like it should say print false if it’s not a number. If it is a number, check the if statement for a true result. If that fails, check the elif for a true result. if it fails again check the else statement for a true result. if that fails print false (but feel like I need a 4th statement to get it to say false at the end, hope that makes sense).
Your code so far
distance_mi = 1
is_raining = True
has_bike = True
has_car = True
has_ride_share_app = True
if distance_mi == 0:
print('False')
if distance_mi <= 1 and is_raining != 'True':
print('True')
elif distance_mi <= (2-6) and has_bike == 'True' and is_raining != 'True':
print('True')
else:
if 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
Thank you, I didn’t realize when if statements are nested they won’t be evaluated if the outer condition was false. Will see if I can figure it out from that and correct the Booleans/strings.
I changed the print strings so I could see which line was making the print code work but cant for the life of me figure out this won’t work any help would be greatly appreciated, also not sure how to add my new code into this chat now. Just cut and paste???
I just kept changing what was indented not understanding what it was actually doing until it passed. Where can I find info on indentations so I can try and figure out what I changed that caused it to work?