+ 1
Why must I use the parentheses when using print ? Can't I just print " Helloworld " instead ? It works on my laptop coding
6 Respostas
+ 2
Unlike previous versions of python, print is a function and like every function, it needs parentheses. You might be using python 2 in your laptop for it to work without them.
+ 2
That is one of the major differences between python 2 and 3.
just like KINGDX explained, print is now a function in python3. That comes with the advantage to use additional options for printing out to the console and default settings if not mentioned.
+ 2
Then, your laptop is running Python 2.6 or 2.7. This is the default version that comes pre-installed on all Mac Books. (Note: Never delete this version from your Mac! Use an environment such as anaconda instead).
+ 1
I see , I was learning at codecademy.com , never knew I was learning the outdated version haha
+ 1
btw thanks guys
0
parentheses so that python interpreter knows that its printing a string you can print variable values, returns and numbers without parentheses