Here's my code:
for i in range(10):
print(i, end=' ') #This line is throwing an error
SyntaxError: no viable alternative at input '='
I am using Netbeans and Jython 2.7.0
Here's my code:
for i in range(10):
print(i, end=' ') #This line is throwing an error
SyntaxError: no viable alternative at input '='
I am using Netbeans and Jython 2.7.0
You tagged it with python-2.7 and python-3.x, but that shouldn't throw a problem in Python3.
The problem there is that in Python2, print
is a statement, so end = ' '
is invalid syntax.
To get the same result, either put from __future__ import print_function
at the beginning of the script, or say print i,
instead.