Interactive Pythonlast modified July 6, 2020In this part of the Python programming tutorial, we talk about interactive Python interpreter.Python code can be launched in two basic ways. As a script or inside an interactive interpreter.#!/usr/bin/env python# first.pyprint("The Python tutorial")This is an example of a small Python script. It is launched from a UNIX shell.$ ./first.py The Python tutorialInteractive interpreterAnother way of running Python code is the interactive Python interpreter. The Python interpreter is very useful for our explorations. When we quickly want to test some basic functionality of the Python language and we don't want to write a whole script. To get the interactive interpreter, we execute the Python command on our favourite shell.$ python3Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linuxType "help", "copyright", "credits" or "license" for more information.>>>This is the welcome message of the Python interpreter. We see theversion of Python on our machine. In our case it is Python 3.5.2. The ">>>" is the prompt used in the Python interactive mode. To leave the interpreter and return back to the shell, we can type Ctrl+Dor quit(). Typing Ctrl+Lclears the screen of the Pythoninterpreter.
Now we can query for some useful information.>>> creditsThanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousandsfor supporting Python development. See for more information.If we type creditswe get some information about organizations involved in Python development.>>> copyrightCopyright (c) 2001-2016 Python Software Foundation.All Rights Reserved.Copyright (c) 2000 BeOpen.com.All Rights Reserved.Copyright (c) 1995-2001 Corporation for National Research Initiatives.All Rights Reserved.Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.All Rights Reserved.The copyrightcommand gives the copyright of the Python programming language.The license()command provides several pages regarding the license of Python.