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,030
  • 21
  • 100
  • 124
user3124081
  • 402
  • 1
  • 3
  • 13

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,030
  • 21
  • 100
  • 124
mgilson
  • 283,004
  • 58
  • 591
  • 667