- 1

python

can we use both single quote and double quote in the print statement to print our message??

5th Jan 2018, 5:41 AM
vishnuram
vishnuram - avatar
5 Answers
+ 7
@Pegasus Good point!
5th Jan 2018, 6:53 AM
David Ashton
David Ashton - avatar
+ 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/
5th Jan 2018, 5:57 AM
David Ashton
David Ashton - avatar
+ 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
5th Jan 2018, 6:43 AM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar
+ 5
It's the same thing man print("hello")===print('hello')
5th Jan 2018, 6:27 AM
į Œį ŒCode X
į Œį ŒCode X - avatar
0
thank u so much for ur reply.........
22nd Mar 2018, 5:54 PM
vishnuram
vishnuram - avatar