How can I print a sentence quote with the quotation marks untouched? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 14

How can I print a sentence quote with the quotation marks untouched?

eg; a string with an output with it's quotes untouched "hello world".

14th Sep 2020, 6:50 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
30 Respostas
+ 10
print(' "hello world" ')
14th Sep 2020, 6:52 PM
Oma Falk
Oma Falk - avatar
+ 10
if you want to include the quote characterĀ "Ā inside of a string? If you try to executeĀ print("I said "Wow!" to him")Ā thisĀ will give error. the problem is that Python sees one stringĀ "I said "followed by somethingĀ Wow!Ā which is not in the string. This is not what we intended! PythonĀ doesĀ have two simple ways to put quote symbols in strings. You are allowed to start and end a string literal with single quotes (also known as apostrophes), likeĀ 'blah blah'. Then, double quotes can go in between, such asĀ 'I said "Wow!" to him.' You can put a backslash character followed by a quote (\"Ā orĀ \'). This is called anĀ escape sequenceĀ and Python will remove the backslash, and put just the quote in the string. https://code.sololearn.com/cny1a64d9ryd/?ref=app
14th Sep 2020, 7:16 PM
SOUMYA
SOUMYA - avatar
+ 5
use your brain please šŸ˜”šŸ˜”
14th Sep 2020, 7:03 PM
Oma Falk
Oma Falk - avatar
+ 5
Jordan AlloyšŸ˜‚ if I tell u a bit harsh to use your brain, I desperately try to teach you. And I have confidence that u find the solution. In my eyes you are a bit lazy. It is a kick in your .... you know. šŸ˜‰
14th Sep 2020, 7:11 PM
Oma Falk
Oma Falk - avatar
+ 5
print(' "hello world" ') (quotation)
15th Sep 2020, 9:40 AM
PsĶ„ycĶ£hĶ«ą¹FĢ¶
PsĶ„ycĶ£hĶ«ą¹FĢ¶ - avatar
+ 5
G'day Jordan AlloyšŸ˜‚. You should go back and have a look at the very first batch of Python modules in Basic Concepts. The lessons under the Strings module cover the "Escape Characters" SOUMYA SAHU is talking about, as well as what Oma Falk was saying.
15th Sep 2020, 11:03 AM
Mark McClan
Mark McClan - avatar
+ 3
print(repr("hello'world"))
15th Sep 2020, 6:05 PM
Subhash
Subhash - avatar
+ 2
Oma Falk look if your not interested in teaching me I suggest you just avoid my questions. No one learn the way your coming off man!
14th Sep 2020, 7:07 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
+ 2
~ swim ~ thanks man, got it now. One love
14th Sep 2020, 7:08 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
+ 2
Oma Falk you can say what you want bro, am trying to make use of my little resources to achieve great results, so don't tell me am lazy. You obviously don't know why I registered all those courses, and you don't know why my learning is progressive. I'll take your insults as a credit bro, this place is filled with different people. Using your limited perception on someone is wrong.
14th Sep 2020, 7:14 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
14th Sep 2020, 7:22 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
+ 2
Jan Markus thanks bud, learnt it. šŸ‘¼šŸ¾
14th Sep 2020, 7:53 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
+ 2
Mark McClan done the review already, i totally understand now. Thanks for your replies.
15th Sep 2020, 1:25 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
+ 2
15th Sep 2020, 1:26 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar
+ 2
print(ā€œ\ā€hello world\ā€ā€)
15th Sep 2020, 4:32 PM
Satvik Virmani
Satvik Virmani - avatar
+ 2
print ("\"write sentence\" ")
16th Sep 2020, 5:26 AM
Meenakshi Narayan
Meenakshi Narayan - avatar
+ 2
You can also use triple single or triple double quotes. print(""" "Hello" 'World!' """) output: "Hello" 'World!'
16th Sep 2020, 5:30 AM
Fasih Raza
+ 2
Use the escape sequence \" for printing the quotes, so that it will not be formatted.
16th Sep 2020, 8:54 AM
Amal Prabhakaran
Amal Prabhakaran - avatar
+ 2
print("\"Hello World\" ")
16th Sep 2020, 1:23 PM
Ravi Teja
Ravi Teja - avatar
+ 1
Oma Falk wow, i have spent time trying to make that possible. Thanks šŸ˜Š
14th Sep 2020, 6:55 PM
Jordan Alloy āœļø
Jordan Alloy āœļø - avatar