Print and input functions


In the lesson we use print without a parenthesis. When I tried it on my own editor I received an error that I was missing the parenthesis. Do later versions of Python require parenthesis?
Also, could I use the input() function instead of the raw_input() function as I was receiving an error message when when I entered raw_input() into my editor?


You have to use the correct format for the different versions, in python 3.* print was changed to a built-in function.

In Python 2.*

print "Anything"

In Python 3.*



Thanks! Is that the same for input()?



Python 3.*


Python 2.*


As a note:

Python 2.* does have an input function built in, it is something like eval() but it does so to the users input. Meaning that it can be very bad.


a = input("Input something:")

The user does some fancy stuff

# Prompt: Input something:

As you can see easily it can end badly.