So after trying to get the whole program to work at once, I decided to start over doing one step at a time and on step 5 (on the “If the distance is less than or equal to 1 mile:”) is where im stuck because it skips tests 15 and 16 but marks tests 17 and 18 as done where it says “if the distance is between 1 and 6 miles” but I didnt put 6 miles anywhere. Can someone please explain?
Your code so far
distance_mi = 1
is_raining = False
has_bike = False
has_car = False
has_ride_share_app = False
if not isinstance (distance_mi, int):
print('False')
if distance_mi <= 1 and is_raining == False:
print('True')
else:
print('False')
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
At this point your code gives such answers, that both 17 and 18 tests are passing. They are not checking what happens outside of the specified boundary, so it’s not a concern for them that result for distances above of 6 will be the same - that might be checked by different tests.
After some fixes, I got step 5 to work. But on step 6, I get a syntax error when I type <=6, so I didn’t type it in and continued to step 7. It marks all the other tests as done except for test 19. Also, in the terminal, the word ‘False’ is shown. I’m not sure if anything needs to be typed in the terminal. I would appreciate it if someone could explain to me how my code works.
Your code so far
distance_mi = 7
is_raining = False
has_bike = False
has_car = False
has_ride_share_app = False
if distance_mi == False:
print('False')
#miles less than or equal to 1
if distance_mi <= 1 and is_raining == False:
print('True')
elif distance_mi <= 1 and is_raining:
print('False')
#miles between 1 and 6 miles
elif distance_mi > 1 and has_bike == False and is_raining == True:
print('False')
#miles greater than 6
elif distance_mi > 6 and has_ride_share_app:
print('True')
elif distance_mi > 6 and has_car:
print('True')
elif distance_mi > 6 and has_car == False and has_ride_share_app == False:
print('False')
else:
print('False')
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner