Interactive Terminal
Overview
Teaching: 5 min
Exercises: 5 minQuestions
What does the terminal/console do for me?
Objectives
To understand the usefulness of the interactive terminal
To discern between the functionality of the editor and the interactive terminal
The Interactive Terminal (in Spyder, the IPython Console) allows you to execute commands and interact with data inside any number of IPython interpreters.
Each console in Spyder is executed in a separate process, allowing you to run scripts independently.
A terminal/console/shell is an implementation of a read–eval–print loop (REPL), that is, input and executes commands, and returns the result to the user.
IPython Console features include:
- Introspection,
- Display rich media,
- Understand shell syntax,
- Perform tab (code) completion,
- and records History.
Expected Benefits
- Immediate response to our ideas.
- Quick exploration of the available functionalities.
- Keep a record of our attempts.
- Work in isolated processes.
Let’s Write a first version of Bingo Cards printer
We will use the print
function and the for
structure to print the BINGO card in a nicer format.
Things to pay attention to:
- Syntax coloring in the console
- Code completion in the console
- Integrated help in the console
- Each console is a separated process.
String format
https://pyformat.info/ is a nice resource to look for an overview and examples of python string formatting.
Key Points
The interactive terminal is a special feature of dynamic or interpreted languages
The interactive terminal allows us to play and test ideas before writing -definitive- code in the editor