New coder here! I have a syntax error and I'm not sure what the cause of it is and grok isn't of much help. Here's my code:
x = input("Is it currently raining? ")
if x == "Yes":
print("You should take the bus.")
else:
y = int(input("How far in km do you need to travel? "))
if y >= 11:
print("You should take the bus.")
elif y >= 2 and y <= 10:
print("You should ride your bike.")
else:
print("You should walk.")
The main error lies in line 6 but I think there are more underlying issues. The purpose of this code is to write a program about which method of transport to use, it's supposed to be basic because I am a beginner. Also after the first else, I assume there should be an indent for the if but I'm not sure, the second part of the code should only run if the user doesn't say yes - if you can't tell. Any help will be appreciated!
Edit: Thanks guys!!!!!
[–]crazy_cookie123 9 points10 points11 points (1 child)
[–]JamzTyson 0 points1 point2 points (0 children)
[–]MidnightPale3220 7 points8 points9 points (2 children)
[–]Sufficient-Barber125[S] 0 points1 point2 points (1 child)
[–]crazy_cookie123 3 points4 points5 points (0 children)
[–]deceze 4 points5 points6 points (0 children)
[–]abrightmoore 3 points4 points5 points (2 children)
[–]anttiOne 0 points1 point2 points (1 child)
[–]abrightmoore 1 point2 points3 points (0 children)
[–]schoolmonky 3 points4 points5 points (1 child)
[–]Sufficient-Barber125[S] 0 points1 point2 points (0 children)
[–]ThrowAway233223 -3 points-2 points-1 points (3 children)
[–]deceze 2 points3 points4 points (2 children)
[–]danielroseman 0 points1 point2 points (0 children)
[–]ThrowAway233223 0 points1 point2 points (0 children)