I'm learning Python and can't even write the first example:
print 2 ** 100
this gives SyntaxError: invalid syntax
pointing at the 2.
Why is this? I'm using version 3.1
This question is related to
python
You need parentheses:
print(2**100)
The syntax is changed in new 3.x releases rather than old 2.x releases: for example in python 2.x you can write: print "Hi new world" but in the new 3.x release you need to use the new syntax and write it like this: print("Hi new world")
check the documentation: http://docs.python.org/3.3/library/functions.html?highlight=print#print
They changed print
in Python 3. In 2 it was a statement, now it is a function and requires parenthesis.
Here's the docs from Python 3.0.
Source: Stackoverflow.com