+ 1

Is it possible to use print"hello world" instead of print('hello world')?? What difference will it make.

18th Nov 2016, 6:21 AM
vismaya
6 Réponses
+ 4
In python 3.5 you must use print(). I think this is the difference
18th Nov 2016, 6:34 AM
Elchin
Elchin - avatar
+ 1
print "hello world" would give an error - the code is incorrect due to the missing parentheses. print('hello world') and print("hello world") are both correct and output the same text (hello world). In python strings can be enclosed in either single or double quotation signs.
18th Nov 2016, 6:35 AM
Rill Chritty
Rill Chritty - avatar
+ 1
@vismaya yea, you can.
18th Nov 2016, 6:53 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
yes you can use print"something" in python 2.x
18th Nov 2016, 7:27 AM
Hamidreza Bayat
Hamidreza Bayat - avatar
0
so can i use the syntax print"hello world" without () in python 2.x ??
18th Nov 2016, 6:40 AM
vismaya
0
yes u can
19th Nov 2016, 8:58 PM
harish g