Interactive Python.docx - Interactive Python last modified...

This preview shows page 1 - 3 out of 8 pages.

Interactive Python last modified July 6, 2020 In 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.py print("The Python tutorial") This is an example of a small Python script. It is launched from a UNIX shell. $ ./first.py The Python tutorial Interactive interpreter Another 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. $ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> This is the welcome message of the Python interpreter. We see the version 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 + D or quit() . Typing Ctrl + L clears the screen of the Python interpreter.
Now we can query for some useful information. >>> credits Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See for more information. If we type credits we get some information about organizations involved in Python development. >>> copyright Copyright (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 copyright command gives the copyright of the Python programming language. The license() command provides several pages regarding the license of Python.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture