"" these quotes are included in python's basic structure. What if we want output with these quotes like I mentioned in question?
Asked
Active
Viewed 3,092 times
3 Answers
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
- 36,219
- 6
- 36
- 71
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
- 444
- 3
- 12
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
- 2,322
- 14
- 26