Hi, I built a translator in Python which changes vowels to letter “g” but in line 7, I firstly used elif instead of else but I recieved a feedback that says “invalid syntax”
Why can’t I use elif in line 7? I’m a beginner and I don’t really understand.
Welcome, mugetetiks.
After writing elif
did you include a condition? Remember, an elif
is exactly the same as an if
. Eg.
if some_condition:
# Do stuff...
elif some_other_condition:
# Do other stuff...
The above runs. The below is invalid:
if some_condition:
# Do stuff...
elif:
# Do other stuff...
For future posts, please do not use a screenshot of code. It is a lot more difficult to debug.
2 Likes