0
tuna = "fish"
if tuna == "fish":
   print ' this is fish'

I am getting an invalid syntax error while executing the code. Please correct my code.

JJJ
  • 32,902
  • 20
  • 89
  • 102

1 Answers1

1

In python 3, print is a function print('hello world') not a statement as in python 2.x print 'hello world', basically you forgot the brackets:

tuna = "fish"
if tuna == "fish":
    print('this is fish')

The output would be:

this is fish

K DawG
  • 13,287
  • 9
  • 35
  • 66