+ 1
Difference between normal print and print command
Then what js the difference btw print('hello') and just 'hello'
3 Respuestas
+ 12
'hello' and print('hello') in python intrepeter may look like same, but with print command there will be output string hello but simply 'hello' won't make any output.
try it on pycharm or code playground here.
+ 7
@Agus Mei:
Even in the Python command line interpreter, it doesn't look exactly the same:
>>> 'hello'
'hello'
>>> print('hello')
hello
>>> test = 'hello'
>>> test
'hello'
@Ram Datta:
If you're talking about the difference suggested by @James, that's in Python2 'print' command is a statement, so doesn't require parenthesis ( rounded brackets ), like an 'if', 'for', 'while' statements. However, in Python2 you can also use the 'print' command as a function, wich is the onlay way to do in Python3, as 'print' command is no longer a statement but a function ( so parenthesis are mandatory ^^ )
+ 1
thanks..