I genuinely don’t know what I’m doing wrong, it says line 24 now (it said 11 before). SyntaxError: invalid syntax
Your code so far
distance_mi = 5
is_raining = 'False'
has_bike = 'True'
has_car = 'False'
has_ride_share_app = 'False'
if distance_mi <= 1:
if not is_raining:
print('True')
else:
print('False')
if distant_mi > 1 and distant_mi <= 6:
if not has_bike and is_raining:
print('False')
else:
if not has_bike and not is_raining:
print('False')
if has_bike and not is_raining:
print('True')
if distance_mi > 6 and has_ride_share_app:
print('True')
else:
if has_car:
print('True')
elif:
if not has_car or has_ride_share_app:
print('False')
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Challenge Information:
Build a Travel Weather Planner - Build a Travel Weather Planner
If you have an error message please share the complete text of the message.
Error messages are extremely useful and often contain the precise information that you need to resolve a problem. What do you think the error message tells you about your code?
You are getting that error because your usage of the elif keyword(on line 24), is syntactically incorrect for two reasons:
The syntax is if…elif…else. elif statements precede else statements, if any. In your code, your elif block comes after the else block. That is a syntax error.
Just like if keywords, an elif keyword must have an accompanying conditional statement. Yours does not,
Also note two additional issues in your code:
You’re using strings like 'False' and 'True' instead of boolean values (False, True).
You have a typo: distant_mi vs distance_mi, which will raise a NameError.
Fixing those should help your program run correctly.
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Get Help > Ask for Help button located on the challenge.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.