+ 1
print('I\'m learning Python!') print("A number enclosed in double quotes:\"42"")
Each time I put a backslash for the second line, I get an EOL error I don't know what to do someone help me out
7 Answers
+ 5
You need to place one more double quotes at the end of second statement to not get any error.
Or maybe you are trying to escape quotes around 42 , for that place black slash after 42 as well .
+ 3
Thanks a bunch. It worked
+ 2
Hi Delight!
EOL error means End Of Line error. This happens when you forgot ending quotes, or because you tried to make a string extend past one line. Here, you're missing to escape an (") at the end.
This should work fine.
print('I\'m learning Python!')
print("A number enclosed in double quotes:\"42\"")
Also, there is an other method to print quoted text that you can use single quotes outside double quotes.
This is what I mentioned above
print('A number enclosed in double quotes:"42" ')
#ignore the last space.
Output: A number enclosed in double quotes:"42"
0
Still doesn't work
0
print('I\'m learning Python. It\'s easy.')
0
Real solution is
print("l\'m learning Python. It\'s easy.")
0
Doesn't work.