Tell us what’s happening: so , i write the code to match all the requirements and it still shows that they are not completed/matched. for example: i write so that when the distance is falsy it would print falsy but it still shows an x near that task. Pls help …
Your code so far
distance_mi = 1
is_raining = False
has_bike = True
has_car = False
has_ride_share_app =True
if not distance_mi == False:
print('True')
else:
print('False')
if distance_mi <= 1 and is_raining == False:
print('True')
elif distance_mi <= 1 and is_raining == True:
print('False')
elif distance_mi == 0:
print('False')
else:
print('False')
if (distance_mi > 1 and distance_mi <= 6) and (has_bike == True and is_raining == False):
print('True')
else:
print('False')
if distance_mi > 6 and has_car == True:
print('True')
elif distance_mi > 6 and has_ride-share_app == True:
print('True')
elif distance_mi > 6 and (has_car == False and has_drive_share_app == False):
print('False')
else:
print('False')
hmmm, so i made one big chunk of code ( if…elif…else) but now every task except 22 and 24 is completed, but i dont undertsand why arent tey completed, it seems to me as if everything should be good and the error it shows says “Your code raised an error before any tests could run. Please fix it and try again.” is strange as in the terminal it doesnt show any errors. idk what to do. Pls help my code:
distance_mi = 2
is_raining = False
has_bike = True
has_car = False
has_ride_share_app = True
if bool(distance_mi) == False:
print('False')
elif distance_mi <= 1 and is_raining == False:
print('True')
elif distance_mi <= 1 and is_raining == True:
print('False')
elif (distance_mi >1 and distance_mi <= 6) and (has_bike == True and is_raining == False):
print('True')
elif (distance_mi >1 and distance_mi <= 6) and (has_bike == False or is_raining == True):
print('False')
elif distance_mi > 6 and (has_car == True or has_drive_share_app == True):
print('True')
elif distance_mi > 6 and (has_car == False or has_drive_share_app == False):
print('False')
elif distance_mi > 6 and (has_car == False or has_drive_share_app == False):
print('False')
elif distance_mi > 6 and has_drive_share_app == True:
print('True')
else:
print('True')
because there it says “// running tests
22. Your code raised an error before any tests could run. Please fix it and try again.
24. Your code raised an error before any tests could run. Please fix it and try again.
// tests completed
// console output
True”