+3 votes

1 Answer

+3 votes
by (user.guest)
 
Best answer

Python

The answer is dependent on the version of Python you're running.

On Python 2

raw_input() takes the exact value of what was passed  to it, and returns it as a string.

input() is simply a raw_input() that is evaluated. i.e. eval(raw_input))

By implication, input() expects a syntactically correct python statement while raw_input() does not.

On Python 3

raw_input() from Python 2 was renamed to input() in Python 3.

What was previously defined as input() in Python 2 no longer exists in Python 3.

You can replicate the behaviour of the Python 2 input() by wrapping the new input() around the eval() function i.e. eval(input()).


Please leave a comment below if you found this answer helpful. Happy coding!

Related questions

Welcome to CPEN Talk
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

No one has ever spoken during review of Chuck Norris' code and lived to tell about it.
...