Error with syntax in Python 3.7

1

I'm practicing a course exercise and came across the following error below. I am using Python 3.7. What is the problem with this typing?

convite = 'Flavio Henrique Almeida'
parte1 = convite[0:4]
parte2 = convite[11:15]
print "%s %s" % (parte1, parte2)

Error:

File "<stdin>", line 1
  print "%s %s" % (parte1, parte2)
                ^
SyntaxError: invalid syntax
    
asked by anonymous 02.09.2018 / 18:40

1 answer

2

The error is in print "%s %s" % (parte1, parte2) . In Python 3 you need to put the arguments of print in parentheses ( , ) , just like any other function call.

It would look like this:

print("%s %s" % (parte1, parte2))
    
02.09.2018 / 18:48