-5

"" these quotes are included in python's basic structure. What if we want output with these quotes like I mentioned in question?

Vixit
  • 9
  • 1
  • 3

3 Answers3

4

Quotes are exchangeable in python, meaning that you can use single ones inside double ones and viceversa:

print("'Hi!'")
'Hi!'
print('"Hi!"')
"Hi!"

or use scape characters:

print("\"Hi!\"")
"Hi!"
Netwave
  • 40,134
  • 6
  • 50
  • 93
0

So Python prints everything inside the quote marks. So... if you want your string to be "hello [your name]" you need to put that inside the quotation marks to print it.

it would look like this.

print(""hello [your name]"") 

and your string would be "hello [your name]"

SnitchingAuggie
  • 494
  • 3
  • 14
0

You can use double qoutes inside the single qoutes . Try the below code !

Code :

name="Muhammad Usman"
print('"Hello ' + name + '"')

Output :

"Hello Muhammad Usman"
Usman
  • 1,983
  • 15
  • 28