0

I downloaded Python for windows 64bit and it doesn't run the most basic commands. I've stripped my program down to one line, which python is complaining about.I suspect it must be with whatever I downloaded but don't know how to proceed. Advice?

print "Let's play Battleship!"

Results in:

  File "b.py", line 2
    print "Let's play Battleship!"
                                 ^
SyntaxError: invalid syntax
Gareth Latty
  • 86,389
  • 17
  • 178
  • 183
smartyollie
  • 161
  • 3
  • 9

1 Answers1

4

The print statement changed in 3.x. Try:

print("let's play battleship!")
tdelaney
  • 73,364
  • 6
  • 83
  • 116
  • Incidentally, this format of the call is also valid in 2.7 – hd1 Mar 05 '15 at 23:19
  • 1
    @hd1 - only kinda. It breaks down with multiple arguments where python 2 will print it out as a tuple: `print("hello","there")` --> `('hello', 'there')`. – tdelaney Mar 05 '15 at 23:25