Strings | Sololearn: Learn to code for FREE!



Some characters can't be directly included in a string. For instance, double quotes can't be directly included in a double quote string; this would cause it to end prematurely. Can someone explain and give an example of the meaning of this?

9/5/2019 7:23:40 PM

i XL

12 Answers

New Answer


If you do print(" " hi" ") it will give you error. But you can do print(" 'hi' ") or print(' "hi" ')


you can use the back-slash: print("\"hi\"")


" ": The string starts at " The string ends at the next " So if you do " " hi " " There are 2 empty strings and some unknown variable (hi) , causing error. The same thing with ' '


🌷 Alex Tusinean 🔥 and there is no operator between the Strings so that's an error source too


Anton Böhler indeed.


You can use the back-slash and this is known as 'escaping special characters' Secondly, enclose you text in a pair of three apostrophes. Do as if you are doing documentation (like docustring). I have included an example of this code.


String Jika Anda ingin menggunakan teks dengan Python, Anda harus menggunakan string. String dibuat dengan memasukkan teks antara dua tanda kutip tunggal atau ganda. Ketika konsol Python menampilkan stri



You can't be use same quote inside same quote like outside Ex write ("my name is "yuwandeval" i m from delhi") if you write this you got error beacase whenever you compile the program compiler thought first quote is ("my ) this one but close of this quote is "yuwan deval..but it is not its close points got order... Solition is that you use quote inside different quote so you never get error example ("My name is 'yuwan deval' and i m form ' delhi' yeap ") Output. My name is ' yuwan deval ' and i m from ' delhi' yeap.


I could not understand what is string


Anuth Gowda1, a string is a set of characters placed in quotes. Perhaps read on data types for you to fully understand strings and what you can do or not do on them.


Use back Slash to print \