competitive_programming:python_interpreter
Differences
This shows you the differences between two versions of the page.
|
|
competitive_programming:python_interpreter [2018/08/14 10:17] jguerin created |
competitive_programming:python_interpreter [2018/08/14 11:05] (current) jguerin Fleshed out more for possible article skeleton. |
====== Python3 Interactive Interpreter ====== | ====== Python3 Interactive Interpreter ====== |
| The Python3 interactive interpreter (typically invoked with ''python3'' on the command line) allows for the entry of arbitrary Python3 commands, making it a great calculator and a great place to test simple ideas. The interpreter should feel familiar to users of shells made popular in many operating systems and [[https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop|read-eval-print]] loops in other languages. |
| |
| ===== Invocation ===== |
| In Linux the interactive interpreter is invoked directly by calling ''python3'' without any arguments (e.g., a ''.py'' file to execute). In Windows this is bundled into the [[https://en.wikipedia.org/wiki/IDLE|IDLE]] [[https://en.wikipedia.org/wiki/Integrated_development_environment|development environment]]. |
| |
The Python3 interactive interpreter (typically invoked with ''python3'' on the command line) allows for the entry of arbitrary Python3 commands, making it a great calculator and a great place to test simple ideas. | This will open the Python3 prompt: |
| <code python> |
| $ python3 |
| Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03) |
| [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin |
| Type "help", "copyright", "credits" or "license" for more information. |
| >>> |
| </code> |
| |
| The ''quit'' command exits. |
| |
| ===== Using the Interactive Interpreter ===== |
| |
| ==== Basics Commands ==== |
| |
| ==== The Help System ==== |
| |
| ==== Loops ==== |
| The interactive interpreter is quite limited compared to what can be accomplished in an actual Python3 program (i.e., a ''.py'' file), however its functionality can be easily extended slightly beyond that of one-liners. (Nested) Loops can be quickly tested in order to evaluate syntax and functionality. |
| |
==== Interactive Interpreter: Loops ==== | |
<code python> | <code python> |
>>> from math import * | >>> from math import * |
competitive_programming/python_interpreter.1534259855.txt.gz · Last modified: 2018/08/14 10:17 by jguerin