for i in range(10):
x = 0.1*i
print x
print x/(1-x*x)
I'm trying to print the results out using for loop, but it says Syntax Error: Missing parentheses in call to 'print'
.
I'm using Python 3.4 and I'm new to Python.
for i in range(10):
x = 0.1*i
print x
print x/(1-x*x)
I'm trying to print the results out using for loop, but it says Syntax Error: Missing parentheses in call to 'print'
.
I'm using Python 3.4 and I'm new to Python.
The error message is crystal clear, isn't it? Your print
function is missing the parentheses needed for a function call:
print(x)
Python 2 had a print
statement where the syntax print x
was correct; Python 3 has changed this. You should be learning Python from a Python 3 specific resource, for example the Python tutorial.
You syntax for print statement is valid in 2.X but it has changed in 3.X version. You need parentheses around your print statement like:
print (x/(1-x*x))