print('I\'m learning Python!') print("A number enclosed in double quotes:\"42"") | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

7th Aug 2021, 1:08 PM
Delight Amadi
Delight Amadi - avatar
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 .
7th Aug 2021, 1:10 PM
Abhay
Abhay - avatar
+ 3
Thanks a bunch. It worked
7th Aug 2021, 1:43 PM
Delight Amadi
Delight Amadi - avatar
+ 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"
7th Aug 2021, 1:36 PM
Python Learner
Python Learner - avatar
0
Still doesn't work
7th Aug 2021, 1:21 PM
Delight Amadi
Delight Amadi - avatar
0
print('I\'m learning Python. It\'s easy.')
22nd Feb 2022, 7:33 AM
kishore S
0
Real solution is print("l\'m learning Python. It\'s easy.")
18th Mar 2022, 3:02 PM
Siddharth Palariya
0
Doesn't work.
18th Mar 2022, 5:27 PM
Satish Kumar