1

Why does the following code crash?

I'm following along with the tutorial, and it seems my version is a bit newer than the one I'm following. The syntax I wrote makes complete sense to me, yet claims that it's invalid syntactically:

var1 = "Hello world! "

print var1

or:

print "Hello world!"
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user3124081
  • 412
  • 1
  • 4
  • 16

1 Answers1

2

In Python 3.x, print is a function, so you have to call it.

For example,

print('hello world')
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mgilson
  • 300,191
  • 65
  • 633
  • 696