+ 1

Difference between normal print and print command

Then what js the difference btw print('hello') and just 'hello'

9th May 2017, 2:49 AM
Ram Datta
Ram Datta - avatar
3 Respostas
+ 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.
9th May 2017, 3:00 AM
Agus Mei
Agus Mei - avatar
+ 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 ^^ )
9th May 2017, 7:19 AM
visph
visph - avatar
+ 1
thanks..
9th May 2017, 3:33 AM
Ram Datta
Ram Datta - avatar