Hire Our Expert Programmer & Technical Writer To Do Your Capstone Project
+3 votes
in Programming Languages & Algorithms by

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 and share with other students in your network if you found this answer helpful. Happy coding!


Welcome to CPENTalk.com

Disclaimer: Every user is solely responsible for anything that he/she posts or uploads on CPENTalk.
...