Python can be used in basically two ways: interactive and non-interactive. When the interpreter is invoked with no command line options, it enters interactive mode. That means you can enter Python statements directly to a prompt and have them executed immediately. Using this mode allows you to enter short snippets of code to test ideas and experiment with the language.

As previously stated, to enter the interactive mode you have to simply invoke the python3 interpreter with no command line options. You should be greeted with something similar to this

Python 3.4.3 (default, Mar 25 2015, 17:13:50)
[GCC 4.9.2 20150304 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.

The >>> at the end of the output is the prompt, that is, the way the interpreters tells you it's awaiting your commands. You can, for example, enter arithmetic expressions, press enter, have them evaluated (i.e. executed) by the interpreter and receive the result. Let's try!

>>> 2 + 2

As you can see, the interpreter correctly answers you that the result of the expression 2 + 2 is 4, then it goes to a new line and shows the prompt again, waiting for further commands.

Document Tags and Contributors

Contributors to this page: chrisdavidmills, klez
Last updated by: chrisdavidmills,