EOL while Scanning string literal
Occurs when any of the Quotes('', "", """""") is opened and not closed properly.
E.g
TEST THE EXAMPLES BELOW IN PYTHON PROMPT
IDLE ENVIRONMENT CONTAINING THREE ANGLE BRACKETS (>>>)
Testing the examples below will all result in errors EOL.
>>> 'Seu texto vai aqui
>>> 'Seu texto vai aqui"
>>> "Seu texto vai aqui"""
If single quotes have been opened, it should be closed. It is worth noting that
quotation marks are different from each other.
'' -> single quotes
"" -> double quotes
"""""" -> triple quotes
If you open simply, only single quotes can close simple quotes. And so on.
And in your case, a "Character escape" was incorrectly used which is this backslash with the single quote (\')
, making the Python interpreter understand that its single quote at the end is considered a literal quote, that is, part of the text, rather than a quote or a Python text delimiter. To resolve, add a single quote (\'')
or remove the backslash (')
.
I did that right there, and you’re still making the mistake
– King Trollex
I edited the answer with the changed code and a working print to see if it helps you!
– Gabriel Hardoim
Question, the int means oq? It’s q I’m learning using a workbook q I downloaded from the internet
– King Trollex
int()
is a function that converts the parameter passed to integer type. Ex:"4"
is a string, by being in quotes, that with theint("4")
flipped4
which is a number– Gabriel Hardoim
Maybe learning from someone teaching is better! I recommend the videos from
Curso em Vídeo
by Gustavo Guanabara– Gabriel Hardoim
thanks for the tip, we’re together man is we :)
– King Trollex
refit the code from scratch and now will give error: Unexpected ident
– King Trollex
which IDE you are using? it usually points to the error line. This looks like you have misidentified some part of the code
– Gabriel Hardoim
to using IDE 3.9.2. Plus I was able to resolve the error more now n is showing the answer q I want
– King Trollex
agr the problem should be in the comparison, no
if
– Gabriel Hardoim
@Kingtrollex if I helped you, mark the answer as right please :D
– Gabriel Hardoim
I can’t seem to solve this problem
– King Trollex
what the code looks like?
– Gabriel Hardoim
i am unable to progress with the error: Unexpected ident. I have written and rewritten the code several times and I am stuck in the same place
– King Trollex
You have to give exact 4 spaces or press tab 1 time
– Natan Fernandes
thanks for the tip
– King Trollex
I did what you said and the same mistake keeps happening.
– King Trollex