# Elif Syntax Error

**URL:** <https://discuss.python.org/t/elif-syntax-error/52533>\
**Category:** Python Help\
**Tags:** help\
**Created:** [May 3, 2024, 5:41pm UTC](https://discuss.python.org/t/elif-syntax-error/52533 "2024-05-03T17:41:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamwellerfahy](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adamwellerfahy](https://discuss.python.org/u/adamwellerfahy)\
**Post date:** [May 3, 2024, 5:41pm UTC](https://discuss.python.org/t/elif-syntax-error/52533/1 "2024-05-03T17:41:20Z")

</div>

```python
def askGuessDifficulty():
    printSlow('Alright! I\'ll pick a number from 1 to 100, and you try to guess it!')
    printSlow('''You can do easy mode (E), with infinite guess; normal mode (N), with 10 guesses;
    hard mode (H), with 5 guesses; or custom mode (C), where you pick how many guesses you get!''')
    guessDifficulty = input()
    global guesses
    if guessDifficulty.lower() == 'e':
        guesses = 999
        confirmChoice(input('You want easy mode, right? (Please input \"Yes\" or \"No\")')
    elif guessDifficulty.lower() == 'n': # line 10 <- error on this line, see below for error message
        guesses = 10
        confirmChoice(input('You want normal mode, right? (Please input \"Yes\" or \"No\")')
    elif guessDifficulty.lower() == 'h':
        guesses = 5
        confirmChoice(input('You want hard mode, right? (Please input \"Yes\" or \"No\")')
    elif guessDifficulty.lower() == 'c':
        confirmChoice(input('You want custom mode, right? (Please input \"Yes\" or \"No\")')

```

File “/home/adamwellerfahy/minigames.py”, line 28  
elif guessDifficulty.lower() == ‘n’:  
^^^^  
SyntaxError: invalid syntax  
SyntaxError: invalid syntax

I don’t understand why my “elif” is a syntax error

---

<div class="post-metadata">

**Author:** ![franklinvp](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/franklinvp/32/11142_2.png) [@franklinvp](https://discuss.python.org/u/franklinvp)\
**Post date:** [May 3, 2024, 5:48pm UTC](https://discuss.python.org/t/elif-syntax-error/52533/2 "2024-05-03T17:48:14Z")

</div>

There is a parenthesis missing in the line above.

All the `confirmChoice` are missing the parenthesis that encloses its argument.

---

<div class="post-metadata">

**Author:** ![adamwellerfahy](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@adamwellerfahy](https://discuss.python.org/u/adamwellerfahy)\
**Post date:** [May 3, 2024, 5:48pm UTC](https://discuss.python.org/t/elif-syntax-error/52533/3 "2024-05-03T17:48:59Z")

</div>

Oh my gosh I can’t believe I missed that! Thank you so much!

---

<div class="post-metadata">

**Author:** ![kknechtel](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kknechtel](https://discuss.python.org/u/kknechtel)\
**Post date:** [May 3, 2024, 7:36pm UTC](https://discuss.python.org/t/elif-syntax-error/52533/4 "2024-05-03T19:36:44Z")

</div>

This comes up commonly.

> <https://stackoverflow.com/questions/24237111/why-do-i-get-syntaxerror-invalid-syntax-in-a-line-with-perfectly-valid-syntax>
