Wednesday, January 3, 2018

Python interactive mode - REPL

Read–Eval–Print Loop (REPL) is an interactive language shell or interactive computer programming environment. The advantage of having REPL is that the environment receives input from user, evaluates and results in an interactive manner. No need for scripting.


JITSUNDA-M-C2XF:~ jitsunda$ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> 

I use python3, 

Simply type python3, we will get ">>>" prompt, we can write simple instructions and get the results as shown below



JITSUNDA-M-C2XF:~ jitsunda$ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hi")
hi
>>> 4+3
7
>>> x = "jith"
>>> x
'jith'

>>> 

No comments: