We must write code which outputs string with "" . How can we do this?(in python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

We must write code which outputs string with "" . How can we do this?(in python)

3rd Mar 2021, 3:56 PM
Ozodbek
Ozodbek - avatar
3 Answers
+ 1
Hi! use the character escape operator
3rd Mar 2021, 4:02 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
if you want to write string with double quotes, you could wrap your string in single quotes... and conversely if you have both, you could escape the one used to enclose the string: print("I'm new to \"Python\""); also, you could enclose string in triple quotes (either single or double), so you doesn't need to escape quotes until you put 3 next to each others or 1 or more at the end of the string (in addtion, that allow multiines strings): print("""I'm new to "Python"! Hello world ;)""")
3rd Mar 2021, 9:53 PM
visph
visph - avatar
0
ok I will try
3rd Mar 2021, 4:10 PM
Ozodbek
Ozodbek - avatar