(Two answers) 10 months ago
I'm sure this syntax is correct, but I get a SyntaxError: invalid character identifier error similar to the title in else:
.
Could you please let me know where the mistake is?
for i in range(v):
if i%2 == 0:
print("i=",i)
else:
print("")
That's a common mistake.
else:
The first character in this line is a full-width blank.
You can correct it to two half-width spaces.
By the way, if you type an error message in the search field at the top of this site, you will find a similar article like the one below, so please try it from now on.
What is the cause of the error SyntaxError: invalid character in identifier
SyntaxError: I want to resolve invalid character identifier
I don't know how to improve the error code. SyntaxError: invalid character in identifier
© 2025 OneMinuteCode. All rights reserved.