+ 7

Where to write a \ into a string to separate double quotes enclosed number from string (“”) ???

I need to output by using \ print(“A number enclosed in double quotes: 42”) After having tried a whole hour I wrote my own code with same output ... but it’s not accepted .... Can somebody help me please

11th Oct 2020, 4:03 PM
K1auDIa KaDaM0UR0
K1auDIa KaDaM0UR0 - avatar
5 odpowiedzi
+ 8
Thx very much but I found it from myself...!! print(‘A number enclosed in a double string: “42”’) Just needed to change strings double quotes in single quotes 😆
11th Oct 2020, 4:22 PM
K1auDIa KaDaM0UR0
K1auDIa KaDaM0UR0 - avatar
+ 3
lol I forgot that ;)
11th Oct 2020, 4:23 PM
Vaibhav Kale
Vaibhav Kale - avatar
+ 2
Try this: print(' A number enclosed in double quotes : \"42\" ')
11th Oct 2020, 4:20 PM
Vaibhav Kale
Vaibhav Kale - avatar
+ 2
Keeping some knowledge about escape sequences is handy btw, for example you would be able to handle situations where you might need both " and ' quotes in one string and it is applicable throughout most languages
11th Oct 2020, 4:24 PM
Shahil Ahmed
Shahil Ahmed - avatar
+ 1
"Here a enclosed thing : \"42\""
11th Oct 2020, 4:19 PM
Shahil Ahmed
Shahil Ahmed - avatar