0

can anyone explains how to write the code of the double quote strings I'll be thankful for you

I need an explanation not answer 😁

23rd Aug 2016, 6:10 PM
Loo
Loo - avatar
8 Answers
+ 4
double quote is special character, thus it has to be escaped. so string should be in quotes and if the string itself contains special characters, all of them should be escaped with backslash, thus " \" " is correct answer. if you need a string which contains just single backslash, then it will be like this "\\"
23rd Aug 2016, 6:39 PM
Anton Cskt
Anton Cskt - avatar
+ 1
both the lines do not contain any special characters, so it would be usual print with \n as new line. another option is using triple quotes
23rd Aug 2016, 7:11 PM
Anton Cskt
Anton Cskt - avatar
0
ok say that I wanna type this string me : hello sir the officer : hello!!! how my code will look like ?
23rd Aug 2016, 6:43 PM
Loo
Loo - avatar
0
it would look like this. print("me:hi") print("the officer: hello")
23rd Aug 2016, 7:10 PM
Aditya Warade
Aditya Warade - avatar
0
print("me: hello sir") print("the officer : hello!!!)
24th Aug 2016, 2:00 AM
Darth Vador
Darth Vador - avatar
0
You basically just put print and right in front of print you put parentheses. When you do that you're telling the computer you want something outputed. Then you put quotes within the parentheses so then you're telling the computer you want specific words outputed.
24th Aug 2016, 2:04 AM
Darth Vador
Darth Vador - avatar
0
print("me : hello sir") print("the officer : hello!!!")
24th Aug 2016, 4:49 AM
chundru srilekha
chundru srilekha - avatar
0
Ok how about the sentence like this Tom's teacher: He's not a bad boy.! He's very smart
24th Aug 2016, 8:07 AM
Loo
Loo - avatar