- 1
python
can we use both single quote and double quote in the print statement to print our message??
5 Answers
+ 7
@Pegasus Good point!
+ 13
Yes:
print("hi") => hi
print('hi') => hi
print("'hi'") => 'hi' # single enclosed in double
print('"hi"') => "hi" # double enclosed in single
best way to find out is try it in the Code Playgroundš
e.g. click 'try it yourself' here and experiment:
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2270/
+ 6
@David Ashton To add on:
'this is a string'
"this is a string"
' ' 'this is a
docstring' ' '
" " "this is also
a docstring" " "
Thr intermediate spaces is ONLY FOR differentiation. In reailty, just omit them
+ 5
It's the same thing man
print("hello")===print('hello')
0
thank u so much for ur reply.........