Where to write a \ into a string to separate double quotes enclosed number from string (ā€œā€) ??? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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