+ 1
Is the parentheses necessary in the code of print?
3 ответов
+ 4
In python 3, the parentheses are obligatory, otherwise you get a synthax error.
+ 3
In Python before 3 you can ommit the parenthesis, as 'print' is a statement (more than just a buily-in function, as the if/else, while and others basic structures). So, in Python<3 the function way of writting it witj parenthesis is provide by commodity.
Since Python 3, 'print' is no more a statement, but a real built-in function, so require parenthesis which becomes mandatory...
0
Short answer - yes.
Longer answer -this is one major difference between python2 and python3. So it is entirely possible that you will find code without parentheses floating around on the Net - it is python2 code. :)