Print "Welcome to Python!" or print("Welcome to Python!")?


#1

https://www.codecademy.com/courses/introduction-to-python-6WeG3/0/1?curriculum_id=4f89dab3d788890003000096
When I type:

print "Welcome to Python!"

Into Python 3.6.0 shell, it doesn't work, but:

print("Welcome to Python!")

works!

I am doing this codeacademy python course to supplement my tertiary studies, and I have never coded before. Thanks for your feedback.


#2

print "Welcome to Python!"                # <--- Python2
print("Welcome to Python!")               # <--- Python3

In Python2 print is a statement but in Python3 it's a function.
It was introduced with Python3.0. (What’s New In Python 3.0)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.