can anyone look this python error :an illegal target for a variable annotation

Question:

Hard to believe this simple code doesn’t run.
Can anyone help with it please.

enter image description here

enter image description here

enter image description here

Asked By: 070701

||

Answers:

You need to change the If to lowercase, to if

You also need to replace elif with else since elif would not be used in this situation, else would. elif is used when the first condition is false, and the specified elif condition is true. else is used when just the first condition is false, with no other true condition.

Here’s the fixed code:

n = 1

if n > 25:
    print("1")
else:
    print("0")

(It gives no error in VSCode)

Answered By: Ard_Flamingo
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.