I am currently stuck on checks 15 and 16 and I believe it is because of my first if statement. I initially thought I would use the == operand to check if the distance was a falsy and input the check to 0 but that would only work with some variations of my code. Then I checked the forums and saw people use the isinstance command to check if the distance was an int and that as well only worked with certain variations of my code. So I am wondering how I could trouble shoot this issue.
Your code so far
distance_mi = 1
is_raining = False
has_bike = True
has_car = True
has_ride_share_app = True
if distance_mi == 0:
if distance_mi <= 1 and is_raining == False:
print('True')
else:
print('False')
elif distance_mi >= 1 and distance_mi <= 6:
if has_bike == True and is_raining == False:
print('True')
else:
print('False')
elif distance_mi > 6:
if has_car == True or has_ride_share_app == True:
print('True')
else:
print('False')
else:
print('False')
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
The issue is likely your conditions, not the variable type. You don’t need isinstance() here—distance_mi == 0 correctly checks for zero. Go through the FCC requirements and test boundary values like 0, 1, and 6 separately. Also, simplify is_raining == False to not is_raining and has_bike == True to has_bike.
So I completed the workshop but I feel like there are some ways that I can improve it and make it more concise. Is there somewhere I can post it and discuss on ways I can improve it?