Python Forum

Full Version: Introduction to escaping characters in strings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, brand new to coding so please help out with the fundamental.

I am trying to fix this up, please show me what I am supposed to do

print('I/m learning Python!')
print("A number enclosed in double quotes: "42"")

What is it I need to change??

Thanks!
First and foremost please put your code in tags.
print('I/m learning Python!')
print("A number enclosed in double quotes: "42"")
Then provide what you have already tried so you can be pointed in the direction that would best help you learn and understand.
Also, be clear about your query... what is it you are trying to do and how are you going about it.

Regarding the printing of the two lines you need to learn the point of quotations when printing a string.
If you are trying to show a piece of the string in quotes you need to change the initial quotation marks used to single ' instead of " so they do not conflict.
print('A number enclosed in double quotes: "42"')
And the first string:
print("I'm learning Python!")
When writing code I personally use single quotes for most things and double quotations when needed in a string or other function.