for i in range(10):
x = 0.1*i
print x
print x/(1-x*x)
我正在尝试使用 for 循环打印结果,但它显示 Syntax Error: Missing parentheses in call to 'print'
.
我正在使用 Python 3.4,而且我是 Python 新手。
最佳答案
错误消息非常清楚,不是吗?您的print
function缺少函数调用所需的括号:
print(x)
Python 2 有一个 print
语句,其中语法 print x
是正确的; Python 3 改变了这一点。您应该从 Python 3 特定资源学习 Python,例如 Python tutorial .
关于Python for循环打印错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27329048/