can anybody please tell me why this is giving me syntax error in idle?
def printTwice(bruce):
print bruce, bruce
SyntaxError: invalid syntax
can anybody please tell me why this is giving me syntax error in idle?
def printTwice(bruce):
print bruce, bruce
SyntaxError: invalid syntax
You seem to be trying to print incorrectly.
You can use a Tuple:
Or you can use formatting in a string in Python ~2.7:
Or use a function in Python 3:
Check the version of Python being used; the variable
sys.version
contains useful information.That is invalid in Python 3.x, because
print
is just a normal function and thus requires parenthesis:(The behavior in Python 2.x is different, where
print
was a special statement.)